protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { //int userid = Convert.ToInt32(gvDetails.DataKeys[e.RowIndex].Values["UserId"].ToString()); string product = GridView1.DataKeys[e.RowIndex].Values["product"].ToString(); con.Open(); SqlCommand cmd = new SqlCommand("delete from shopping where product=" + product, con); int result = cmd.ExecuteNonQuery(); con.Close(); if (result == 1) { BindDetails(); //lblresult.ForeColor = Color.Red; //lblresult.Text = username + " details deleted successfully"; } }
e.RowIndex
string product = GridView1.DataKeys[e.RowIndex].Value;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)