asp.net.ph

Skip Navigation Links

Adding DropDownList Controls to a Web Forms Page

Controls You Can Use on Web Forms   ASP.NET Standard Controls   DropDownList Control


Essentially, to create a working DropDownList control, you need to add the control to the page and specify the list of items in the control.

The below procedures show the minimum steps needed to display a DropDownList control.

To add a DropDownList control to a Web Forms page

  1. Declare an <asp:DropDownList> element on the page. For syntax, see DropDownList Control Syntax.
  2. Optionally set the list’s base properties.
  3. <asp:dropdownlist id="myList" width=100 runat="server">
  4. 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, or a list generated from a data source. For this example, we use statically defined list items.
Static DropDownList Example
Run Sample | View Source
See Also

Adding Items in a List Control   Populating a List Control from a Database



© 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