The DropDownList Web Control

The DropDownList Web control enables users to select from a single-selection drop-down list (for example, a combo box). You can control the look of the DropDownList control by setting its height and width in pixels, but you cannot control the number of items displayed when the list drops down. The SelectedIndex and SelectedItem properties provide details about the currently selected element. The DropDownList control supports data binding by using the following five properties: DataSource, DataMember, DataTextField, DataValueField, and DataTextFormatString. As shown in the following code, of these five properties, only DataSource, DataTextField, and DataValueField have a corresponding ASP.NET attribute you can declare: ...

Get Building Web Solutions with ASP.NET and ADO.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.