protected void btndelete_click(object sender, EventArgs e) { Button lb = (Button)sender; GridViewRow gvRow = (GridViewRow)lb.NamingContainer; int rowID = gvRow.RowIndex + 1; if (ViewState["CurrentTable"] != null) { DataTable dt = (DataTable)ViewState["CurrentTable"]; if (dt.Rows.Count > 1) { if (gvRow.RowIndex < dt.Rows.Count - 1) { //Remove the Selected Row data dt.Rows.Remove(dt.Rows[rowID]); } } //Store the current data in ViewState for future reference ViewState["CurrentTable"] = dt; //Re bind the GridView for the updated data GridView1.DataSource = dt; GridView1.DataBind(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)