string sSql; List<DataRow> vntArray; sSql = "Select Emp_number,Name,leave_type_desc,Start_date,end_date from vemployee_leave_details"; vntArray = SqlHelper.FindRec(new SqlDataAdapter(sSql, ConnectionManager.BMP)); if (vntArray != null || vntArray.Count != 0) { // dbgDetail.DataSource = null; dbgDetail.DataBind(); pnlNoData.Visible = true; cmdPrint.Enabled = false; } else { dbgDetail.DataSource = vntArray.CopyToDataTable(); dbgDetail.DataBind(); dbgDetail.HeaderRow.TableSection = TableRowSection.TableHeader; pnlNoData.Visible = false; cmdPrint.Enabled = true; } }