int id;
foreach (GridViewRow item in GridView1.Rows)
{
CheckBox ckb = (CheckBox)item.Cells[0].FindControl("CheckBox1");
if(ckb.Checked)
{
id =Convert.ToInt32( GridView1.Rows[item.RowIndex].Cells[2].Text);
}
}
你输出下 ckb.Checked 看看的它的结果是什么
1、确认一下这个触发后是否被页面重新刷新,检查pageload 是否判断了首次加载
2、是否有勾选checkbox
3、检查控件名是否为CheckBox1
你这代码在哪里调用的,加上
IsPostBack判断了么