html代码如下:
<asp:ListBox id="ListBox1"
Rows="6"
Width="100px"
SelectionMode="Multiple"
runat="server">
//问题是:我想在后台同时对选中的行进行一起操作,比如:我要对选中的两个IP地址一起进行设置,以前只能对一个设置,相关代码如
//下,请问:现在如何做??string[] iparray = ListBox1.SelectedValue.ToString().Split('-');
if (ListBoxWarn.SelectedIndex > -1) //判断是否选择了设备!
{
string choice = RadioButtonListWarn.SelectedValue.ToString();
if (choice == "接口性能阈值")
.............
}
void SubmitBtn_Click(Object sender, EventArgs e)
{ Message.Text = "You chose: <br />"; // Iterate through the Items collection of the ListBox and
// display the selected items.
foreach (ListItem item in ListBox1.Items)
{ if(item.Selected)
{ Message.Text += item.Text + "<br />"; } } }参考:
ListBox.SelectionMode Property
http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.listbox.selectionmode(VS.80).aspx