ASP.NET ListBox Control.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
The ASP.NET ListBox control allows the user to select a single or multiple objects within the Listbox control. The ListBox control is rendered as the HTML select control and the items within the ListBox control are rendered as
HTML option elements.
Working Example.
With the above example, hold down the Ctrl key for multiple selections.
Creating the ListBox Control.
As from the above example.
<asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple">
<asp:ListItem>DELL</asp:ListItem>
<asp:ListItem>HP Computers</asp:ListItem>
<asp:ListItem>SONY</asp:ListItem>
<asp:ListItem>ACER</asp:ListItem>
</asp:ListBox>
The above example will be rendered as HTML with the result below (source).
<select size="4" name="ctl00$ContentPlaceHolder1$ListBox1" multiple="multiple" id="ctl00_ContentPlaceHolder1_ListBox1">
<option value="DELL">DELL</option>
<option value="HP Computers">HP Computers</option>
<option value="SONY">SONY</option>
<option value="ACER">ACER</option>
</select>
|
|