There is a gridview on a Tabcontrol. I take from database the rows of table on it. But i cant solve to delete rows when i select on that gridview to delete from database.
Please help me! I tried with tabcontrols.selectedtab but it doesnt work. Could you please write some small pieces codee how i can do that! Thanks alot.
Loading
felix connelyPosted Apr 30, 2015, 9:05 PM
felix connelyPosted Apr 29, 2015, 4:13 AM
My main problem, probbly its because of tabcontrol. I cant solve the problem.
Prakash TripathiPosted Apr 29, 2015, 3:12 AM
GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
Label lbldeleteid = (Label)row.FindControl("lblID");
conn.Open();
SqlCommand cmd = new SqlCommand("delete FROM detail where id='"+Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString())+"'", conn);
cmd.ExecuteNonQuery();
conn.Close();
gvbind();
You may want to full article on-
http://www.c-sharpcorner.com/UploadFile/9f0ae2/gridview-edit-delete-and-update-in-Asp-Net/
Isham KhanPosted Apr 29, 2015, 2:30 AM