问题描述
我在网格视图中有一个复选框.当我单击保存按钮时,我检查后面的代码,其中选中了复选框以将记录保存到db.butCheck box.checked属性始终为false.
foreach(GridView1.Rows中的GridViewRow行)
{
CheckBox chbx =(CheckBox)row.FindControl("chk1");
如果(chbx.Checked)
{
}}
但是,它在Mozilla中工作正常,但在IE
I have a checkbox inside a grid view.When i click on save button,i check at code behind which check boxes are checked to save record in db.butCheck box.checked property is always false.
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chbx = (CheckBox)row.FindControl("chk1");
if (chbx.Checked)
{
}}
However it works fine in Mozilla but not in IE
推荐答案
if(!IsPostback)
{
//...
//...
// GridView DataBind
//...
}
这篇关于在网格视图中,checkbox.checked属性始终为false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!