System.Web 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Web.UI.WebControls.ListControl System.Web.UI.IPostBackDataHandler System.Web.UI.SupportsEventValidation System.Web.UI.ValidationProperty("SelectedItem")

In this topic:

Introduction

Accessibility

Declarative Syntax

## Introduction

Use the control to create a single-selection drop-down list control. You can control the appearance of the control by setting the , , and properties.

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

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

Use the property to programmatically determine the index of the item selected by the user from the control. The index can then be used to retrieve the selected item from the Items collection of the control.

## Accessibility

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.

## Declarative Syntax

`<asp:DropDownList AccessKey="string" AppendDataBoundItems="True|False" AutoPostBack="True|False" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset" BorderWidth="size" CausesValidation="True|False" CssClass="string" DataMember="string" DataSource="string" DataSourceID="string" DataTextField="string" DataTextFormatString="string" DataValueField="string" Enabled="True|False" EnableTheming="True|False" EnableViewState="True|False" Font-Bold="True|False" Font-Italic="True|False" Font-Names="string" Font-Overline="True|False" Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| Large|X-Large|XX-Large" Font-Strikeout="True|False" Font-Underline="True|False" ForeColor="color name|#dddddd" Height="size" ID="string" OnDataBinding="DataBinding event handler" OnDataBound="DataBound event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnSelectedIndexChanged="SelectedIndexChanged event handler" OnTextChanged="TextChanged event handler" OnUnload="Unload event handler" runat="server" SelectedIndex="integer" SelectedValue="string" SkinID="string" Style="string" TabIndex="integer" ToolTip="string" ValidationGroup="string" Visible="True|False" Width="size" > <asp:ListItem Enabled="True|False" Selected="True|False" Text="string" Value="string" /> </asp:DropDownList>`

Represents a control that allows the user to select a single item from a drop-down list.

- Constructor

  Use this constructor to create and initialize a new instance of the class.

  Initializes a new instance of the class.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void ``

  This member is used primarily by control developers when deriving a custom control from the class.

  Adds HTML attributes and styles that need to be rendered to the specified object.

  An that represents the output stream that renders HTML contents to the client. 1.0.5000.0 2.0.0.0
- Property
  System.Drawing.Color a

  The property is inherited from the class and is not applicable to the control.

  Gets or sets the border color of the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.Browsable(false)
- Property
  System.Web.UI.WebControls.BorderStyle a

  The property is inherited from the class and is not applicable to the control.

  Gets or sets the border style of the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.Browsable(false)
- Property
  System.Web.UI.WebControls.Unit a

  The property is inherited from the class and is not applicable to the control.

  Gets or sets the border width for the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.Browsable(false)
- Method
  System.Web.UI.ControlCollection To be added

  Creates a collection to store child controls.

  Always returns an .

  1.0.5000.0
  2.0.0.0
- Method
  2.0.0.0
  System.Boolean `` ``

  The ASP.NET page framework tracks all the server controls that return true from this method call, and then invokes the method on the control.

  Processes postback data for the control.

  true if the control's state changes as a result of the postback event; otherwise, false.

  The index within the posted collection that references the content to load. The collection of all incoming name values posted to the server.
- Method
  2.0.0.0
  System.Void

  The ASP.NET page framework calls the method on a control when the method indicates that the state of the list items has changed in the control. The method calls the method to raise the event. Control developers can override the method to perform custom processing when the user selects items in the control.

  Raises events for the control when postback occurs.

- Method
  System.Void `` a To be added To be added 1.0.5000.0
- Property
  System.Int32 a

  Use the property to programmatically specify or determine the index of the selected item from the control. An item is always selected in the control. You cannot clear the selection from every item in the list at the same time.

  The indexes for the items in the control are zero-based.

  Gets or sets the index of the selected item in the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue(0)
- Method
  1.0.5000.0
  2.0.0.0
  System.Boolean `` `` To be added.

  Processes posted data for the control.

  true if the posted content is different from the last posting; otherwise, false.

  The key value used to index an entry in the collection. A that contains post information.
- Method
  1.0.5000.0
  2.0.0.0
  System.Void To be added.

  Raises events for the control on postback.

- Property
  System.String To be added a To be added 1.0.5000.0 2.0.0.0 System.ComponentModel.Localizable(true) System.ComponentModel.DefaultValue("")
- Method
  2.0.0.0
  System.Void

  The control does not support multiple selections and throws an exception.

  Always throws an exception because multiple selection is not supported for the control.