Controls You Can Use on Web Forms ASP.NET Standard Controls ListBox Control
The process of adding a ListBox Web server control consists primarily of setting options for how items should be displayed and whether users can select multiple items.
- Declare an <
asp:ListBox
> element on the page. For syntax, see ListBox Control Syntax.
- Set the following properties:
Property |
Description |
Rows |
Set to specify how many items should be displayed at once.
NOTE: You can also set the Height property to a pixel value. If you do, it takes precedence over the value of the Rows property. However, not all browsers support the Height property, so you should set the Rows property also. |
SelectionMode |
Set to Single or Multiple to specify how many items users can select. |
Adding items to the list control is a separate process that depends on whether you will display a static list or a list generated dynamically at run time. For details, see Adding Items in a List Control.
Adding Web Server Controls to a Web Forms Page