System.Web.UI.WebControls Namespace
A data-bound list control that renders its content using specified templates.
Visibility |
Constructor |
Parameters |
public |
DataList |
( )
|
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 ] |
|
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.
BaseDataList Working with the DataList Control
|
|