Share via


ViewMode Property

Sets or returns the view mode of an ObjectList control.

public ObjectListViewMode ViewMode {
   get,
   set
}

Remarks

Allows the user to set the current display mode of the ObjectList control.

A view mode is of type ObjectListViewMode. The following options are available for this property through the ObjectListViewMode enumeration.

Member name Description
List This view displays each field of the item, including title and value. In HTML, this view is combined with the Commands view, with the commands appearing as hyperlinks below the details.
Commands This is the command's view in WML. This is the default view displayed when the page containing the object list is rendered for the first time. It consists of either the label fields of the items, or (when TableFields is not empty) a table with columns corresponding to the table fields and rows corresponding to items. When there is more information in the Details view, a hyperlink for each item displaying the Details view is rendered, by default reading More.
Details This view is rendered separately only for WML devices. It consists of a menu with the ObjectList class's commands, along with a menu item displaying the Details view. For HTML devices, this view is combined with the Details view, with the commands appearing as hyperlinks below the details.

Note   You must first select an item before setting this enumeration to Commands or Details view. An attempt to set the enumeration before selecting an item throws an exception.

A view mode is persisted in a private view state, so that, regardless of whether the EnableViewState property of the ObjectList object is true, the view mode is persisted as a private field. However, if the EnableViewState property is false, the items collection is not persisted between requests, requiring a data bind to be repeated for each request.

See Also

Supporting Private View State

Applies to: ObjectList Class