如何在网格视图中获取复选框ID [英] How to get a Check box id in Grid View

查看:37
本文介绍了如何在网格视图中获取复选框ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在网格视图中获取复选框ID ...

我将复选复选框的输出设置为false ..

我试过了这个:

How to get a check box id in a grid view...
I am getting the out put of the checked checkbox as false..
I have tried this:

int k = 0;
//Checkther whether atleast one check box is selected or not
for (int i = 0; i <= GridViewExample.Rows.Count - 1; i++)
{
       GridViewRow row = GridViewExample.Rows[i];
       CheckBox Ckbox = (CheckBox)row.FindControl("cbkCheck");
       //bool Ckbox = ((CheckBox)row.FindControl("cbkCheck")).Checked;
       if (Ckbox.Checked == true)
       //if (Ckbox)
       {
            k++;
       }
}

推荐答案





试试这个



foreach(Gridview1.Rows中的Gridviewrow gvr)

{

if((( CheckBox)gvr.findcontrol(CheckBox1))。选中== true)

{





}

}
Hi,

try this

foreach(Gridviewrow gvr in Gridview1.Rows)
{
if(((CheckBox)gvr.findcontrol("CheckBox1")).Checked == true)
{


}
}


这篇关于如何在网格视图中获取复选框ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆