public void GetOccupation() { DataTable ldtOccupation = new DataTable(); ldtOccupation = mobjOccupationBLL.GetAllOccupation(); if (ldtOccupation.Rows.Count > 0 && ldtOccupation != null) { dgvOccupation.DataSource = ldtOccupation; dgvOccupation.DataBind(); Session["OccupationDetails"] = ldtOccupation; int lintRowcount = ldtOccupation.Rows.Count; lblRowCount.Text = "<b>Total Records:</b> " + lintRowcount.ToString(); pnlShow.Style.Add(HtmlTextWriterStyle.Display, ""); hdnPanel.Value = ""; } else { pnlShow.Style.Add(HtmlTextWriterStyle.Display, "none"); hdnPanel.Value = "none"; } }