⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listboxselectedmultiple.aspx

📁 asp.net技术内幕的书配源码
💻 ASPX
字号:
<Script Runat="Server">

Sub Button_Click( s As Object, e As EventArgs )
  Dim itmProduct As ListItem
  Dim strList As String

  For each itmProduct in lstProducts.Items
    If itmProduct.Selected Then
      strList &= "<li>" & itmProduct.Text
    End If
  Next
  lblList.Text = strList
End Sub

</Script>

<html>
<head><title>ListBoxSelectedMultiple.aspx</title></head>
<body>

<form Runat="Server">

<asp:ListBox
  ID="lstProducts"
  SelectionMode="Multiple"
  Runat="Server">
  <asp:ListItem Text="Hair Dryer" />
  <asp:ListItem Text="Shaving Cream" Selected="True"/>
  <asp:ListItem Text="Electric Comb"/>
</asp:ListBox>

<asp:Button
  Text="Pick Multiple Products!"
  OnClick="Button_Click"
  Runat="Server" />

<hr>

Selected Item(s):
<asp:Label
  ID="lblList"
  Runat="Server" />

</form>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -