Compiler Error Message: CS1061: 'System.Web.UI.WebControls.GridViewDeletedEventArgs' does not contain a definition for 'RowIndex' and no extension method 'RowIndex' accepting a first argument of type 'System.Web.UI.WebControls.GridViewDeletedEventArgs' could be found (are you missing a using directive or an assembly reference?)
Line 223:        string stor_id = Convert.ToInt32(GridView2.DataKeys[e.RowIndex].Values["stor_id"].ToString());
 
DashBoard.aspx
OnRowCancelingEdit="GridView2_RowCancelingEdit" OnRowDeleted="GridView2_RowDeleted" OnRowEditing="GridView2_RowEditing" OnRowUpdating="GridView2_RowUpdating" style="margin-right: 3px">






DashBoard.cs
 
protected void GridView2_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
string stor_id = Convert.ToInt32(GridView2.DataKeys[e.RowIndex].Values["stor_id"].ToString());
con.Open();
SqlCommand cmd1 = new SqlCommand("delete from Teachers_Reg where Reg_ID=" + stor_id, con);
int result = cmd1.ExecuteNonQuery();
con.Close();
if (result == 1)
{
ShowData();
lblmsg.BackColor = Color.Red;
lblmsg.ForeColor = Color.White;
lblmsg.Text = stor_id + " Deleted successfully....... ";
}
}