Tips:ColumnScope为checkBoxlist名称
1 选中所有项
foreach (ListItem item in this.ColumnScope.Items)
{
item.Selected = true;
}
2 取消选中所有项
foreach (ListItem item in this.ColumnScope.Items)
{
item.Selected = false;
}
3获取选中项的所有值
for (int i = 0; i < ColumnScope.Items.Count; i++)
{
if (this.ColumnScope.Items[i].Selected)
{
tempColumnScope += this.ColumnScope.Items[i].Value + ";"; //累加选中项的值
}
}
4checkoboxlist相关属性
RepeatDirection="Horizontal" RepeatLayout="Flow" //项水平显示
RepeatColumns="5" //每行显示5项
CellPadding="20" CellSpacing="10" //每个项之间的间距 (一些浏览器中无效)