//Bind Empty Data Table Overloded #region [Bind Empty Data Table Overloded] public void BindEmptyDataTable(DataSet ds) { try { if (ds.Tables[0].Rows.Count == 0 || ds == null) { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GrdScheme.DataSource = ds; GrdScheme.DataBind(); int columncount = GrdScheme.Rows[0].Cells.Count; GrdScheme.Rows[0].Cells.Clear(); GrdScheme.Rows[0].Cells.Add(new TableCell()); GrdScheme.Rows[0].Cells[0].ColumnSpan = columncount; GrdScheme.Rows[0].Cells[0].Text = "No Records Found"; } else { GrdScheme.DataSource = ds; GrdScheme.DataBind(); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Subjects Grid Bind #region [Subject Grid Bind] private void GrdSchemeBind( ) { try { EWA_Scheme objEWA = new EWA_Scheme(); objEWA.OrganizationId = Convert.ToInt32(Session["OrgId"]); DataSet ds = objBL.SchemeGridBind_BL(objEWA); GrdScheme.DataSource = ds; GrdScheme.DataBind(); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Bind Grid View #region [Bind Grid View] private void BindGridView() { try { EWA_Scheme ObjEWA = new EWA_Scheme(); BL_Scheme ObjBL = new BL_Scheme(); DataSet ds = new DataSet(); SchemeId = ddlScheme.SelectedItem.Value; if (!SchemeId.Equals("Select")) { ObjEWA.SchemeId = Convert.ToInt32(ddlScheme.SelectedItem.Value); ObjEWA.AcademicYearId = Convert.ToInt32(Session["AcademicYearId"]); ObjEWA.OrganizationId = Convert.ToInt32(Session["OrgId"].ToString()); ds = ObjBL.BindScheme_BL(ObjEWA); if (ds.Tables[0].Rows.Count != 0) { GrdScheme.DataSource = ds.Tables[0]; GrdScheme.DataBind(); } else { BindEmptyDataTable(ds); } } else { BindEmptyDataTable(ds); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }