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

Isham KhanRank #2,573 · 543 reputationPosted Apr 28, 2015, 10:30 PM EDT
Prakash TripathiRank #72 · 25.3K reputationPosted Apr 28, 2015, 11:12 PM EDT
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/
felix connely7 reputationPosted Apr 29, 2015, 12:13 AM EDT
My main problem, probbly its because of tabcontrol. I cant solve the problem.
felix connely7 reputationPosted Apr 30, 2015, 5:05 PM EDT