asp.net.ph

DataList Class

System.Web.UI.WebControls Namespace


A data-bound list control that renders its content using specified templates.

DataList Class Members

Collapse   Constructors

Visibility Constructor Parameters
public DataList ( )

Collapse   Fields

Visibility Name Type
public static const CancelCommandName String
public static const DeleteCommandName String
public static const EditCommandName String
public static const SelectCommandName String
public static const UpdateCommandName String

Collapse   Properties

Visibility Name Value Type Accessibility
public AlternatingItemStyle TableItemStyle [ Get ]
public AlternatingItemTemplate ITemplate [ Get , Set ]
public EditItemIndex Int32 [ Get , Set ]
public EditItemStyle TableItemStyle [ Get ]
public EditItemTemplate ITemplate [ Get , Set ]
public ExtractTemplateRows Boolean [ Get , Set ]
public FooterStyle TableItemStyle [ Get ]
public FooterTemplate ITemplate [ Get , Set ]
public GridLines GridLines [ Get , Set ]
public HeaderStyle TableItemStyle [ Get ]
public HeaderTemplate ITemplate [ Get , Set ]
public Items DataListItemCollection [ Get ]
public ItemStyle TableItemStyle [ Get ]
public ItemTemplate ITemplate [ Get , Set ]
public RepeatColumns Int32 [ Get , Set ]
public RepeatDirection RepeatDirection [ Get , Set ]
public RepeatLayout RepeatLayout [ Get , Set ]
public SelectedIndex Int32 [ Get , Set ]
public SelectedItem DataListItem [ Get ]
public SelectedItemStyle TableItemStyle [ Get ]
public SelectedItemTemplate ITemplate [ Get , Set ]
public SelectedValue Object [ Get ]
public SeparatorStyle TableItemStyle [ Get ]
public SeparatorTemplate ITemplate [ Get , Set ]
public ShowFooter Boolean [ Get , Set ]
public ShowHeader Boolean [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
protected CreateControlHierarchy ( Boolean useDataSource ) Void
protected CreateControlStyle ( ) Style
protected CreateItem ( Int32 itemIndex , ListItemType itemType ) DataListItem
protected InitializeItem ( DataListItem item ) Void
protected LoadViewState ( Object savedState ) Void
protected OnBubbleEvent ( Object source , EventArgs e ) Boolean
protected OnCancelCommand ( DataListCommandEventArgs e ) Void
protected OnDeleteCommand ( DataListCommandEventArgs e ) Void
protected OnEditCommand ( DataListCommandEventArgs e ) Void
protected OnItemCommand ( DataListCommandEventArgs e ) Void
protected OnItemCreated ( DataListItemEventArgs e ) Void
protected OnItemDataBound ( DataListItemEventArgs e ) Void
protected OnUpdateCommand ( DataListCommandEventArgs e ) Void
protected SaveViewState ( ) Object
protected TrackViewState ( ) Void

Remarks

Like the Repeater, the DataList is a data-bound container control that uses templates to define the rendering of its content. The DataList, though, has built-in support for selection and editing, as well as for specifying display direction, layout, and styles.

At a minimum, every DataList must define an ItemTemplate, though optional templates are available to customize the layout of the list:

Template Name Description
AlternatingItemTemplate If defined, provides the style for alternating items in the DataList. If not defined, ItemTemplate is used.
EditItemTemplate If defined, provides the style for item currently being edited in the DataList. If not defined, ItemTemplate is used.
FooterTemplate If defined, provides the style for the footer of the DataList. If not defined, a footer will not be displayed.
HeaderTemplate If defined, provides the style for the header of the DataList. If not defined, a header will not be displayed.
ItemTemplate Required template that provides the style for items in the DataList.
Separator Template If defined, provides the style for the separator between items in the DataList. If not defined, a separator will not be displayed.
SelectedItemTemplate If defined, provides the style for the currently selected item in the DataList. If not defined, ItemTemplate is used.

In addition, the appearance of the DataList may further be enhanced by setting the following properties to define styles for each of the templates.

Style property Description
AlternatingItemStyle Specifies the style for every other item.
EditItemStyle Specifies the style for the item being edited.
FooterStyle Specifies the style for the footer at the end of the list ( if any ).
HeaderStyle Specifies the style for the header at the beginning of the list ( if any ).
ItemStyle Specifies the style for individual items.
SelectedItemStyle Specifies the style for the selected item.
SeparatorStyle Specifies the style for the separator between each item.

Moreover, the DataList can be set to display its contents in one or more columns, in either vertical or horizontal order, that is rendered in either a table structure or inline with the document flow. These settings are specified with the RepeatColumns, RepeatDirection and RepeatLayout properties, respectively.

For examples illustrating use of this control, see the individual member types of this class. For syntax information, see DataList in ASP.NET Syntax for Web Controls.

See Also

BaseDataList   Working with the DataList Control Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph