Asp.net 在下拉列表中选择多个值

Asp.net 在下拉列表中选择多个值,asp.net,vb.net,Asp.net,Vb.net,我有一个dropdownlist SingleSelection,它从sql数据库检索数据,我想将其更改为MultiSelection select multi value,下面是我的代码 ASP.NET VB 感谢您的努力。请使用列表框而不是下拉列表 asp:DropDownList不直接支持多选。相反,您可以使用CheckBoxList或ListBox控件。 <asp:DropDownList ID="DrpGroup" runat="server" Width="250px" Aut

我有一个dropdownlist SingleSelection,它从sql数据库检索数据,我想将其更改为MultiSelection select multi value,下面是我的代码

ASP.NET VB 感谢您的努力。

请使用列表框而不是下拉列表

asp:DropDownList不直接支持多选。相反,您可以使用CheckBoxList或ListBox控件。
<asp:DropDownList ID="DrpGroup" runat="server" Width="250px" AutoPostBack="True">
</asp:DropDownList>
Protected Sub DrpGroup_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DrpGroup.SelectedIndexChanged
    If (DrpGroup.SelectedValue.ToString.Trim.ToUpper <> "PLEASE SELECT...") Then
        Dim cnt_value As Integer = TDES.FindKey("Select Count(*) from dbo.VU_CUSTOMERBYGROUP WHERE upper(ltrim(rtrim(GROUP_NAME)))='" & DrpGroup.SelectedValue.ToString.Trim.ToUpper & "'")
        lblNumberCount.Visible = True
        lblNumberCount.Text = DrpGroup.SelectedValue.ToString.Trim.ToUpper & " has " & CStr(cnt_value) & " member(s). <br /> The cost for this SMS broadcast will be xxx" & CStr(cnt_value * 0.5)
    End If
    If (DrpGroup.SelectedValue.ToString.Trim.ToUpper = "PLEASE SELECT...") Then
        lblNumberCount.Visible = False
    End If
End Sub
<asp:ListBox  runat="server" ID="multiSelect" SelectionMode="multiple" >
  <asp:ListItem Text="option1" Value="option1"></asp:ListItem>
  <asp:ListItem Text="option2" Value="option2"></asp:ListItem>
  <asp:ListItem Text="option3" Value="option3"></asp:ListItem>
</asp:ListBox>