foreach(ListItem l in CheckBoxList1.Items)
{
l.Selected = true;
}我断点后发现,上面这个循环不执行 ListItem l 这句,到 in 的时候就结束了。请问怎么才能正确循环 CheckBoxList1 内的每一个 Item 呢?
{
l.Selected = true;
}我断点后发现,上面这个循环不执行 ListItem l 这句,到 in 的时候就结束了。请问怎么才能正确循环 CheckBoxList1 内的每一个 Item 呢?
用for吧
foreach (ListItem li in cblrighgs.Items)
{
if (li.Selected == true)
{
str += li.Value+";";
}
} Response.Write(str);