复选框错误

问题描述:

foreach (GridViewRow rw in this.grdEmpSearch.Rows)
{
   ChkBox =(CheckBox(rw.Cells[0].FindControl("chk"));
   if (ChkBox.Checked)
   {
      chkCount++;
   }
}


我编写了上面的代码来检查是否选中了网格内的复选框,但是尽管未选中该复选框,但上面的代码返回的都是true.在所有情况下....


i wrote the above code to check whether the checkbox inside a grid is checked or not but although the checkbox is not checked the above code is returning checked true is all the cases....

鉴于这不是一个网站(因为如果是的话,您会这么说的,对),我假设您可以添加一个检查更改的事件并以这种方式对其进行跟踪.
Given that this is not a website ( because if it was, you''d have said so, right ), I assume you can just add a check changed event and track it that way.