//Siddharth 27 March 2015 Start private void GetMRFAging(string SortExpressionAndDirection) { Rave.HR.BusinessLayer.MRF.MRFDetail MRFAgingBL = new Rave.HR.BusinessLayer.MRF.MRFDetail(); try { DataSet ds = new DataSet(); ds = MRFAgingBL.GetMRFAging(SortExpressionAndDirection); if (ds.Tables[0].Rows.Count != CommonConstants.ZERO) { btnExport.Visible = true; GVMRFAgingReport.DataSource = ds.Tables[0]; Session["MRFAgingReportCount"] = Convert.ToInt32(ds.Tables[0].Rows.Count); GVMRFAgingReport.DataBind(); } else { btnExport.Visible = false; ShowHeaderWhenEmptyGrid(ds); } } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetMRFAging", EventIDConstants.RAVE_HR_MRF_PRESENTATION_LAYER); LogErrorMessage(objEx); } }
private void ShowHeaderWhenEmptyGrid(DataSet ds) { try { GVMRFAgingReport.ShowHeader = true; GVMRFAgingReport.AllowSorting = false; DataTable dt = new DataTable(); dt.Clear(); dt = ds.Tables[0]; DataRow dr = dt.NewRow(); dt.Rows.Add(dr); GVMRFAgingReport.DataSource = dt; GVMRFAgingReport.DataBind(); GVMRFAgingReport.Rows[0].Cells.Clear(); GVMRFAgingReport.Rows[0].Cells.Add(new TableCell()); GVMRFAgingReport.Rows[0].Cells[0].Text = CommonConstants.NO_RECORDS_FOUND_MESSAGE; GVMRFAgingReport.Rows[0].Cells[0].Wrap = false; GVMRFAgingReport.Rows[0].Cells[0].Width = Unit.Percentage(10); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "ShowHeaderWhenEmptyGrid", EventIDConstants.RAVE_HR_MRF_PRESENTATION_LAYER); LogErrorMessage(objEx); } }