DropdownList with Multi select option?
I have a DropDownList as following
<asp:DropDownList ID="ddlRoles" runat="server" AutoPostBack="True" Width="150px">
<asp:ListItem Value="9" Text=""></asp:ListItem>
<asp:ListItem Value="0">None</asp:ListItem>
<asp:ListItem Value="1">Ranu</asp:ListItem>
<asp:ListItem Value="2">Mohit</asp:ListItem>
<asp:ListItem Value="3">Kabeer</asp:ListItem>
<asp:ListItem Value="4">Jems</asp:ListItem>
<asp:ListItem Value="5">Jony</asp:ListItem>
<asp:ListItem Value="6">Vikky</asp:ListItem>
<asp:ListItem Value="7">Satish</asp:ListItem>
<asp:ListItem Value="8">Rony</asp:ListItem>
</asp:DropDownList>
I开发者_StackOverflow中文版 want to select Multiple name at once suppose I want to select Ranu Mohit or Ranu Kabeer Vikky, How its possible?
asp:DropDownList
does not support multiple selects:
VerifyMultiSelect()
: Always throws an HttpException exception because multiple selection is not supported for the DropDownList control.
You can use asp:ListBox
with SelectionMode="Multiple"
instead:
<asp:ListBox SelectionMode="Multiple" ID="lbRoles" runat="server" AutoPostBack="True" Width="150px">
<asp:ListItem Value="9" Text=""></asp:ListItem>
<asp:ListItem Value="0">None</asp:ListItem>
<asp:ListItem Value="1">Ranu</asp:ListItem>
<asp:ListItem Value="2">Mohit</asp:ListItem>
<asp:ListItem Value="3">Kabeer</asp:ListItem>
<asp:ListItem Value="4">Jems</asp:ListItem>
<asp:ListItem Value="5">Jony</asp:ListItem>
<asp:ListItem Value="6">Vikky</asp:ListItem>
<asp:ListItem Value="7">Satish</asp:ListItem>
<asp:ListItem Value="8">Rony</asp:ListItem>
</asp:ListBox>
精彩评论