在GridView中查找选中的复选框... [英] Find Checked Checkbox in GridView...
问题描述
我已经使用脚本在gridview中选中了一个复选框....
然后我想在gridview中获得选中的复选框,所以
以下无法正常运行的代码有助于找出错误
for(int i = 0; i< gdvManageProduct.Rows.Count; i ++)
{
GridViewRow行= gdvManageProduct.Rows [i];
bool isChecked =((CheckBox)row.FindControl("chkDealOfWeek")).Checked;
如果(已检查)
{
}
}
i have used script to checked single checkbox in gridview ....
then i want to get selected checked checkbox in gridview so have
following code which is not working plz help to find out errors
for (int i = 0; i < gdvManageProduct.Rows.Count; i++)
{
GridViewRow row = gdvManageProduct.Rows[i];
bool isChecked = ((CheckBox)row.FindControl("chkDealOfWeek")).Checked;
if (isChecked)
{
}
}
推荐答案
检查是否在ispostback条件下完成了gridview(gdvManageProduct)的绑定,即
如果(不是Ispostback)
{
//绑定网格
}
注意:-如果未完成,则将页面重新发布后,将重新绑定gridview,因此检查的数据将丢失.
Check if the binding of gridview (gdvManageProduct) is done within the ispostback condition i.e
if (not Ispostback)
{
//bind the grid
}
Note:- if it is not done, when the page is posted back, the gridview is rebind, so the checked data will be lost.
这篇关于在GridView中查找选中的复选框...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!