ASP.NET ListBoxControl


Web Server ControlsWeb Server Control

Definition and Usage

The ListBox control is used to create a drop-down list that allows single or multiple selection.

Each selectable item in the ListBox control is defined by a ListItem element!

Tip:This control supports data binding!


Attributes

Attributes Description .NET
Rows The number of rows displayed in the list. 1.0
SelectionMode Whether to allow single or multiple selection. 1.0

ListControl Standard Properties

AppendDataBoundItems, AutoPostBack, CausesValidation, DataTextField, DataTextFormatString, DataValueField, Items, runat, SelectedIndex, SelectedItem, SelectedValue, TagKey, Text, ValidationGroup, OnSelectedIndexChanged

The ListControl class contains all the basic functionality of list controls. Controls that inherit from this control include: CheckBoxList, DropDownList, ListBox, and RadioButtonList controls.

For a full description, please visitListControl Standard Properties。

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, please visitWeb Control Standard Properties。

Control Standard Properties

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible

For a full description, please visitControl Standard Properties。


Examples

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


Web Server ControlsWeb Server Control Other Extensions