这是我的button的代码,没有错误,就是CheckBox的Checked无论选还是没选都是false
private void BtnDelete_Click(object sender, System.EventArgs e)
{
int i=0;
for(int j=0;j<DataGrid1.Items.Count;j++)
{
CheckBox cb=(CheckBox)(DataGrid1.Items[j].Cells[0].FindControl("ChkSelect"));
if(cb.Checked==true)   
{
int id = int.Parse(DataGrid1.Items[j].Cells[1].ToString());
i++;
ire.DelSpectRule(id);
}
}
if(i<0 || i==0)
{
Response.Write("<script>alert('没有选择任何行!')</script>");
}
else
{
Response.Write("<script>alert('已经删除!')</script>");
}
}