Share via


Differences Between ObjectList and List Controls

The ObjectList ASP.NET mobile control differs from the List control in the ways listed in the following table.

Features

ObjectList control

List control

Data-bound

The only way to add items to an object list is to bind the object list to a data source.

Supports adding items statically, programmatically, and through data binding.

Multiple property view

Allows you to view multiple properties, or fields, of each item. Depending on device characteristics, you can render the control as a table that displays more than one property of each object. Alternatively, you can provide UI to allow the user to view additional properties of an object.

Displays one property of each item.

Multiple item commands

Allows you to associate multiple commands with each item. The set of commands for an item can be either shared among all items or unique to the item.

Supports a default command for each item.

Custom pagination and templating

Supported.

Supported.

Note

The table compares the features of the ObjectList and List controls. However, although both controls support custom pagination and templating, the SelectionList control does not support pagination.

Specifying Field Elements Within an Object List

Using an ObjectList control, you can display multiple fields for each item. Each field is associated with a property name. When a List item is bound to a data object, each field is bound to the corresponding property of the object. There are three ways to define a field:

  • Declaratively, using the <Field> element within an object list.

  • Programmatically, by instantiating ObjectListField objects and adding them to the Fields collection of the control.

  • Automatically, by setting the AutoGenerateFields property to true**.**

See Also

Concepts

Accessing Data Using Listing Controls