Click here to Skip to main content
15,885,366 members
Articles / Web Development
Article

DropDownList

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
11 Oct 2013CPOL1 min read 8.1K   2  
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

 

This article was originally posted at http://wiki.asp.net/page.aspx/477/dropdownlist

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.

The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
This is a Collaborative Group

754 members

Comments and Discussions

 
-- There are no messages in this forum --