I asked one week ago: "update all record"
now, I want to delete one record on gridview when I checked checkbox.
there is a checkbox on gridviewrows.
for example; if I checked checkbox on second row. The second row will deleted.
if I Checked checkbox. that code will run.
protected void checkbox1_checkedchange.............{
DELETE FROM table1 WHERE messageId = .........???(which row/message checked .)
}
I can't fix that Which row checked.
how can I that.
Note. I am sorry (very very sory for my english)
ozkan atmacaPosted Jan 29, 2009, 3:08 AM
But I want to delete one row. like gridview delete button
Blocked AccountPosted Jan 28, 2009, 11:52 PM
Hi,
U can do that by using this code.
GridViewRow row = default(GridViewRow);
foreach (var row in GridView1.Rows)
{
CheckBox ChkBoxCell = row.FindControl("chkComplete");
if (ChkBoxCell.Checked == true)
{
// make the delete operation here. here u can find any bound column which contains the unique id for the deletion.
}
}
Happy Coding!!