See Also: DropDownList Members
In this topic:
Use the System.Web.UI.WebControls.DropDownList control to create a single-selection drop-down list control. You can control the appearance of the System.Web.UI.WebControls.DropDownList control by setting the DropDownList.BorderColor, DropDownList.BorderStyle, and DropDownList.BorderWidth properties.
To specify the items that you want to appear in the System.Web.UI.WebControls.DropDownList control, place a System.Web.UI.WebControls.ListItem object for each entry between the opening and closing tags of the System.Web.UI.WebControls.DropDownList control.
The System.Web.UI.WebControls.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 System.Web.UI.Control.DataBind method to bind the data source to the System.Web.UI.WebControls.DropDownList control.
Use the DropDownList.SelectedIndex property to programmatically determine the index of the item selected by the user from the System.Web.UI.WebControls.DropDownList control. The index can then be used to retrieve the selected item from the Items collection of the control.
For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.
Example
<asp:DropDownList AccessKey="string" AppendDataBoundItems="True|