asp.net 中如何获取CheckBoxList的值


string item = string.Empty;

if (CheckBoxList1.SelectedIndex == -1)

{

Alert("请选择");

return;

}

else

{

foreach (ListItem li in CheckBoxList1.Items)

{

if (li.Selected)

{

item += li.Value.ToString() + ",";

}

}

Selected = Selected.Substring(0, Selected.Length - 1);

}