asp.net.ph

Skip Navigation Links

Adding ListBox Controls to a Web Forms Page

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.

To add a ListBox control to a Web Forms page

  • 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.

See Also

Adding Web Server Controls to a Web Forms Page



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note