/// <summary> /// Display Header When GridView Empty with proper message /// </summary> /// <param name="objListSort">EmptyList</param> private void ShowHeaderWhenEmptyGrid() { try { //set header visible gvVisaDetails.ShowHeader = true; //Create empty datasource for Grid view and bind VisaDetailsCollection.Add(new BusinessEntities.VisaDetails()); gvVisaDetails.DataSource = VisaDetailsCollection; gvVisaDetails.DataBind(); //Calculate number of columns in Grid view used for column Span int columnsCount = gvVisaDetails.Columns.Count; //clear all the cells in the row gvVisaDetails.Rows[0].Cells.Clear(); //add a new blank cell gvVisaDetails.Rows[0].Cells.Add(new TableCell()); gvVisaDetails.Rows[0].Cells[0].Text = NO_RECORDS_FOUND_MESSAGE; gvVisaDetails.Rows[0].Cells[0].Wrap = false; gvVisaDetails.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) { if (ValidateVisaControls()) { BusinessEntities.VisaDetails objVisaDetails = new BusinessEntities.VisaDetails(); if (gvVisaDetails.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE) { VisaDetailsCollection.Clear(); } objVisaDetails.CountryName = txtCountryName.Text; objVisaDetails.VisaType = txtVisaType.Text; objVisaDetails.ExpiryDate = Convert.ToDateTime(ucDatePickerVisaExpiryDate.Text); objVisaDetails.Mode = 1; VisaDetailsCollection.Add(objVisaDetails); this.DoDataBind(); this.ClearControls(); btnAddRow.Text = CommonConstants.BTN_AddRow; HfIsDataModified.Value = CommonConstants.YES; } }