private void LoadCaseLaws(GridView eGrid) { GET_CaseLaws_BY_CatTableAdapter index = new GET_CaseLaws_BY_CatTableAdapter(); DataTable dtActsIndexName = index.GetCaseLawsByCat(ddlcatagory.SelectedValue,UPager.CurrentIndex,UPager.PageSize); if (dtActsIndexName.Rows.Count > 0) { eGrid.DataSource = dtActsIndexName; eGrid.DataBind(); if (eGrid.Columns.Count > 0) eGrid.Columns[0].Visible = false; else { eGrid.HeaderRow.Cells[1].Visible = false; eGrid.HeaderRow.Cells[2].Visible = false; eGrid.HeaderRow.Cells[5].Visible = false; foreach (GridViewRow gvr in eGrid.Rows) { gvr.Cells[1].Visible = false; gvr.Cells[2].Visible = false; gvr.Cells[5].Visible = false; } } UPager.ItemCount = Double.Parse(dtActsIndexName.Rows[0]["TotalRows"].ToString()); } }
protected void gvCaseLaws_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridView gv = sender as GridView; GridViewRow row = gv.Rows[e.RowIndex]; int? id = Int32.Parse(row.Cells[2].Text); GET_CaseLaws_BY_CatTableAdapter index = new GET_CaseLaws_BY_CatTableAdapter(); if (id != null & id > 0) { index.Delete_CaseLaws_BY_ID(id); LoadCaseLaws(gv); } }