次の方法で共有


Introduction to the List Control 

The List control displays a static list of items. To enable users to select an item, use a SelectionList control. To view information from a database in tabular format, use an ObjectList control.

A List 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 Mobile Designer Toolbox list

Add items to a list by clicking the ellipsis button (ASP.NET Mobile Designer ellipse) in the Items box in the Properties window, and then using the List Properties dialog box. Set the ItemCount property to specify the number of items that the list contains. On some devices, the list will be paginated. Set the ItemsPerPage property to the preferred number of list items to display on each page.

Using data binding, the List control can populate its items and set property values dynamically based on values in a data source. To bind the control to data, set the DataSource property to an object that implements the IEnumerable interface, and set the DataMember property to the data source's member (such as a dataset table) to read from when the control performs data binding. The DataTextField and DataValueField properties bind data to the Text and Value properties, respectively.

Set the appearance of the List control with the Alignment, ForeColor, Font, StyleReference, and Wrapping properties. To prevent a line break after a List control, set its BreakAfter property to false.

List controls can display items with either numbers or bullets, as specified in the Decoration property. In addition, the items in a list can be rendered as hyperlinks. To display list items as hyperlinks, set the ItemsAsLinks property to true, and set the Value property of each item to the destination URL.

Applying device filters to a List control enables you to specify property override values. Overriding property values customizes the appearance and behavior of the control for specific mobile devices. In addition, device filters enable the use of templates for device-specific customization.

NoteNote

At design time, Visual Studio does not attempt to render pages as they would appear on any particular device, so it does not use the ItemsPerPage property. ASP.NET mobile Web pages do not appear paginated in the designer. However, this property is used at run time.

See Also

Tasks

How to: Add and Configure a List Control

Reference

List

Concepts

Overriding Properties
Introduction to the ObjectList Control
Using Data Binding with ASP.NET Mobile Controls
Introduction to the Form Control
Introduction to the Panel Control

Other Resources

Using Device Filters
Customizing with Control Templates