从DataGridView获取复选框的值 [英] Getting Checkbox value from DataGridView

查看:105
本文介绍了从DataGridView获取复选框的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

如何从DataGridView的CheckBox获取值并将其检查为真还是假

Dear All,

How to get a value from CheckBox from DataGridView and check it as true or false

推荐答案

讨论的一种方法此处 [此处 [ ^ ].
One way discussed here[^].

Some other links -
Here [^]
and
here[^].


CheckBox chk = new CheckBox();
chk  = (CheckBox)gatagrid.Rows[0].Cells[0].FindControl["chkId"];
if(chk.Checked == true){
}




获取该列的值并检查其真(或)假.

尝试以下代码...
Hi,

Get the value for that column and check its true (or) false.

Try the following Code...
for(int x=0;x<dgvView.Rows.Count;x++)
{
  if(dgvView.Rows[x].Cells["CheckBoxColumn"].Value.ToString().Equals("true"))
 {
   //Your Code
 }
             (or)
if(Convert.ToBoolean(dgvView.Rows[x].Cells["CheckBoxColumn"].Value.ToString()))
{
   // Your Code
}
}



干杯:)



Cheers :)


这篇关于从DataGridView获取复选框的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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