ASP.NET DropDownList control
Definition and Usage
DropDownList control is used to create a drop-down list.
DropDownList control each option is defined by a ListItem element!
Note: The control supports data binding!
Attributes
属性 | 描述 | .NET |
---|---|---|
SelectedIndex | 可选项的索引号 | 1.0 |
OnSelectedIndexChanged | 当被选项目的 index 被更改时被执行的函数的名称。 | 1.0 |
runat | 规定该控件是服务器控件。必须设置为 "server"。 | 1.0 |
ListControl standard attributes
AppendDataBoundItems, AutoPostBack, CausesValidation,
DataTextField, DataTextFormatString, DataValueField, Items, runat,
SelectedIndex, SelectedItem, SelectedValue, TagKey, Text,
ValidationGroup, OnSelectedIndexChanged
ListControl control covers all the basic functions of a list control. Controls inherit from this control include: CheckBoxList, DropDownList, ListBox and RadioButtonList control.
For a full description, visit the ListControl standard attributes .
Web Control Standard Properties
AccessKey, Attributes, BackColor, BorderColor,
BorderStyle, BorderWidth, CssClass, Enabled, Font, EnableTheming,
ForeColor, Height, IsEnabled, SkinID, Style, TabIndex, ToolTip, Width
For a full description, visit the Web Control Standard Attributes .
Control Standard Properties
AppRelativeTemplateSourceDirectory, BindingContainer,
ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer,
Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID,
Visible
For a full description, go to Control Standard Attributes .
Examples
DropdownList
In this example, we declare a DropDownList control in an .aspx file. And then create an event handler, display text and selected item in the Label control when the Click event occurs.
Web server control