作者:Cherish雪蕊诗_425 | 来源:互联网 | 2023-10-17 14:30
ListBox.SelectedItem.Value可以获取当前被选中的一个值.但如果ListBox同时有多个值被选中应该如何获取这些值呢?
12 个解决方案
you need to go through each item
foreach (ListItem li in YourListBox.Items)
{
if (li.Selected)
....
}
or
string[] s = Request.Form.GetValues(YourListBox.UniqueID);
for i=0 to listbox.items.count-1
listbox.item(i).selected
next
for(int i=0;i {
if(ListBox.Item[i].selected)
{
Your's Code
}
}
还是老大的string[] s = Request.Form.GetValues(YourListBox.UniqueID);这个好用
string[] s = Request.Form.GetValues(YourListBox.UniqueID)