在asp.net的GridView控件中,复选框状态未更改 [英] CheckBox state is not changed in gridview control in asp.net
本文介绍了在asp.net的GridView控件中,复选框状态未更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
This is my code:
foreach(GridViewRow row in GridView1.Rows)
{
CheckBox cb = (CheckBox)row.FindControl("chkSelect");
if (cb.Checked)
{
// This code not executed;
}
}
事件虽然我已经选择了ChecoBox,但它显示checked = false,
Event though I have seleted the ChecoBox, it shows checked=false,
How to get state of checkbox in gridview?
推荐答案
您的代码没有问题,但是可能在该页面的page_load事件中出现问题.
看看这个
选择GridView控件内的复选框 [
There is no problem in your code but may be issue in your page_load event of that page.
Have a look at this one
Selecting Checkboxes inside GridView Control[^]
这篇关于在asp.net的GridView控件中,复选框状态未更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文