Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

DropDownList

0.00/5 (No votes)
11 Sep 2008 1  
The DropDownList Web server control enables users to select from a single-selection drop-down list box. The DropDownList control is similar to the

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

The DropDownList Web server control enables users to select from a single-selection drop-down list box. The DropDownList control is similar to the ListBox Web server control. It differs in that it shows only the selected item in a box.

To specify the items that you want to appear in the DropDownList control, place a ListItem object for each entry between the opening and closing tags of the DropDownList control.

The DropDownList control also supports data binding. To bind the control to a data source, create a data source, such as a ArrayList object, that contains the items to display in the control. Then, use the Control.DataBind method to bind the data source to the DropDownList control.

Use Its  SelectedIndex property to programmatically determine the selected item index , and use its SelectedValue to get the value of the SelectedItem.

 

DropDownList How To :

How to: Add DropDownList Web Server Controls to a Web Forms Page

How to: Add Items in List Web Server Controls

How to: Determine the Selection in List Web Server Controls

How to: Populate List Web Server Controls from a Data Source

How to: Respond to Changes in List Web Server Controls

How to: Set the Selection in List Web Server Controls

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here