Introduction to the SelectionList Control

The SelectionList control displays a list of items and enables the user to select one or more of them. Applications can render the SelectionList control as a drop-down list box, a selection list box, a set of check boxes, or a set of option buttons (radio buttons). A SelectionList control must be placed within a Form or Panel control, or inside a control's template on a mobile Web page. You can also drag it onto a mobile user control page.

ASP.NET Selection List

Because it does not support pagination, this control works best for short lists. To view more complex information from a database in tabular format, use an ObjectList control.

Selecting items in a SelectionList control does not immediately generate a response from the server side of the application. The form on which the SelectionList appears must be posted back to the server. This is usually accomplished with a Command control. When the Command control posts the form back to the server, the SelectionList control raises a SelectedIndexChanged event, which you can handle in server code. Another way is to add support for devices that can handle client ECMAScript (JavaScript), such as HTML-based browsers. For more information, see SelectionList.

By default, applications render the SelectionList control as a drop-down list. Alter the default by setting the SelectType property. A value of DropDown for the SelectType property enables users to choose one item from the list. To enable them to select more than one item, set the SelectType property to CheckBox or MultiSelectListBox.

To define list items at design time, click the ellipsis button (ASP.NET Mobile Designer ellipse) in the control's Items property box in the Properties window. You can then define items using the SelectionList Properties dialog box.

Alternatively, your application can define the items at run time. This can be accomplished either programmatically or with data binding. The Items property is of type MobileListItemCollection. Therefore, applications add items programmatically using the Add method from the MobileListItemCollection class. Use the SelectionList control's DataMember, DataSource, DataTextField, and DataValueField properties to add items through data binding.

You can customize the appearance of the SelectionList control using device filters, which enable the control to selectively override many property values.

For information about validating user input to this control, see Introduction to the Validation Controls.

See Also

Tasks

How to: Add and Configure a SelectionList Control

Reference

SelectionList

Concepts

Overriding Properties

Introduction to the Form Control

Introduction to the Panel Control

Introduction to the ObjectList Control

Using Data Binding with ASP.NET Mobile Controls

Other Resources

Using Device Filters