如何一次选择多个复选框? [英] How to select more than one checkbox at the time?
本文介绍了如何一次选择多个复选框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有10个复选框的分组框.
我想一次选择多个复选框.
我不知道.
请帮助我.
I have a groupbox with 10 checkboxes in it.
I want to select multiple checkboxes at a time.
I don''t know how.
Please help me.
推荐答案
foreach (Control c in this.groupBox1.Controls)
{
if (c.GetType() == typeof(CheckBox))
{
((CheckBox)c).Checked = true;
}
}
您也可以这样做,
You can do this way also,
foreach (CheckBox c in groupBox1.Controls)
{
if (c.Checked == false)
c.Checked = true;
}
在页面加载中编写以上代码,然后将其签出.....
选中复选框后,即可在foreach循环中编写逻辑.
Write above code in Page Load and check it out .....
Once you get your checkbox then you can write your logic inside foreach loop.
这篇关于如何一次选择多个复选框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文