private void GetDepartments() { DataTable ldtDept = new DataTable(); ldtDept = mobjDeptBLL.GetAllDepartments(); if (ldtDept.Rows.Count > 0 && ldtDept != null) { dgvDepartment.DataSource = ldtDept; dgvDepartment.DataBind(); Session["DepartmentDetail"] = ldtDept; int lintRowcount = ldtDept.Rows.Count; lblRowCount.Text = "<b>Total Records:</b> " + lintRowcount.ToString(); pnlShow.Style.Add(HtmlTextWriterStyle.Display, ""); hdnPanel.Value = ""; } else { hdnPanel.Value = "none"; } }