asp.net后台获取checkBox选中的个数?

2024-12-17 01:14:27
推荐回答(2个)
回答1:

试试用checkBox.SelectedItems.Count来获取选中个数

回答2:

int sum = 0;
foreach (Control c in this.Controls)
{
if (c is CheckBox)
{
CheckBox chk = c as CheckBox;
if(chk.Checked)
sum++;
}
}