/// <summary> /// Display Header When GridView Empty with proper message /// </summary> /// <param name="objListSort">EmptyList</param> private void ShowHeaderWhenEmptyGrid() { try { //set header visible gvProfessionalCourses.ShowHeader = true; //Create empty datasource for Grid view and bind ProfessionalDetailsCollection.Add(new BusinessEntities.ProfessionalDetails()); gvProfessionalCourses.DataSource = ProfessionalDetailsCollection; gvProfessionalCourses.DataBind(); //Calculate number of columns in Grid view used for column Span int columnsCount = gvProfessionalCourses.Columns.Count; //clear all the cells in the row gvProfessionalCourses.Rows[0].Cells.Clear(); //add a new blank cell gvProfessionalCourses.Rows[0].Cells.Add(new TableCell()); gvProfessionalCourses.Rows[0].Cells[0].Text = NO_RECORDS_FOUND_MESSAGE; gvProfessionalCourses.Rows[0].Cells[0].Wrap = false; gvProfessionalCourses.Rows[0].Cells[0].Width = Unit.Percentage(10); } catch (RaveHRException ex) { LogErrorMessage(ex); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "ShowHeaderWhenEmptyGrid", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER); LogErrorMessage(objEx); } }
/// <summary> /// Handles the Click event of the btnAdd control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void btnAdd_Click(object sender, EventArgs e) { Rave.HR.BusinessLayer.Employee.ProfessionalDetails objProfessionalDetailsBAL; if (ValidateControls()) { BusinessEntities.ProfessionalDetails objProfessionalDetails = new BusinessEntities.ProfessionalDetails(); objProfessionalDetailsBAL = new Rave.HR.BusinessLayer.Employee.ProfessionalDetails(); if (gvProfessionalCourses.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE) { ProfessionalDetailsCollection.Clear(); } // 26864-Ambar-Start // Code to accept only one decimal point bool is_decimal_point = false; string str_current_char = null, strScore = txtScore.Text; if ((strScore != string.Empty) || (strScore != null) || (strScore != "")) { for (int i = 0; i < txtScore.Text.Length; i++) { str_current_char = strScore.Substring(i, 1); if ((str_current_char == ".")) { if (is_decimal_point) { lblMessage.Text = "<font color=RED>" + "Percentage can contain only one decimal point." + "</font>"; return; } else { is_decimal_point = true; } } } } // 26864-Ambar-End objProfessionalDetails.CourseName = txtCourseName.Text; objProfessionalDetails.InstitutionName = txtInstituteName.Text; objProfessionalDetails.PassingYear = txtYearofPassing.Text; objProfessionalDetails.Score = txtScore.Text; objProfessionalDetails.EMPId = int.Parse(EMPId.Value); objProfessionalDetails.Mode = 1; ProfessionalDetailsCollection.Add(objProfessionalDetails); objProfessionalDetailsBAL.AddProfessionalDetails(objProfessionalDetails); this.PopulateGrid(objProfessionalDetails.EMPId); this.ClearControls(); lblMessage.Text = "Professional Courses saved successfully."; } }