Latest web development tutorials

ASP.NET ListBox control

Web Server Controls Web server control

Definition and Usage

ListBox control is used to create multiple choice, but choose goods drop-down list.

ListBox control each selectable item is defined by ListItem element!

Note: The control supports data binding!


Attributes

属性 描述 .NET
Rows 在列表中显示的行数。 1.0
SelectionMode 允许单选还是多选。 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

Listbox
In this example, we declare a ListBox control in an .aspx file. Then we create an event handler, when the Click event occurs, the handle text and displays the selected item in the Label control.


Web Server Controls Web server control