- Re Write block of code following way
LinkButton lb = (LinkButton)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)
{
for(int i=0;i<dt.rows.count;i++)>
{
if (i != (rowID - 1))
{
dt.Rows[i][colID]= ((TextBox)GridView1.Rows[i].FindControl("TextBoxID")).Text;
dt.Rows[i][colName]= ((TextBox)GridView1.Rows[i].FindControl("TextBoxName")).Text;
dt.Rows[i][colIsActive]= ((CheckBox)GridView1.Rows[i].FindControl("checkboxActive")).Checked;;
}
}
dt.Rows.Remove(dt.Rows[rowID]);
Gridview1.DataSource = dt;
Gridview1.DataBind();
ViewState["CurrentTable"] = dt;
}
}