ASP.NET Tutoria...login
ASP.NET Tutorial
author:php.cn  update time:2022-04-11 14:18:18

ListBox control


ASP.NET ListBox Control


up.gif Web server control

Definition and usage

ListBox control Create a drop-down list with multiple selections.

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

Tips: This control supports data binding!


Properties

PropertiesDescription.NET
RowsThe number of rows displayed in the list. 1.0
SelectionModeAllow single selection 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 control includes all the basic functionality of a list control. Controls that inherit from this control include the CheckBoxList, DropDownList, ListBox, and RadioButtonList controls.

For a complete description, visit the ListControl 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 complete description, visit Web Control Standard Properties.

Control standard properties

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

For a complete description, visit Control Standard Properties.


Example

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


up.gifWeb Server Control

php.cn