protected void User_RowDelete_Click(Object sender, GridViewDeleteEventArgs e) { // Retrieve the row that raised the event from the Rows // collection of the GridView control. GridViewRow row = modifyUser.Rows[e.RowIndex]; //get roll number from that row String userid = row.Cells[1].Text; //Call the DAL function to delete the student with this roll number enter obj = new enter(); if (obj.DeleteUser(userid) == 1) { Message.Text = "UserID =" + userid + " was Deleted"; loadGrid(); //reload the grid to show the modifications in table } else { Message.Text = "there was some error"; } }