Nitin Sharma

Nitin Sharma

  • NA
  • 154
  • 62k

how to delete a row in gridview

Feb 24 2014 5:21 AM
//int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString());
//if (con.State == ConnectionState.Closed)
//{
// con.Open();
//}
//SqlCommand cmd = new SqlCommand("Delete from gridview where id='" + id + "'", con);
//cmd.ExecuteNonQuery();
//con.Close();
//GridView1.DataBind();
//display();
 how can i delete a row in using row deleting event . i was used this code but its not working in the table i use identity to generate id  

Answers (8)