System.Web.UI.WebControls Namespace
A data-bound list control that renders its content using a specified template for each item in the list.
Visibility |
Constructor |
Parameters |
public |
Repeater |
( )
|
Visibility |
Name |
Value Type |
Accessibility |
public |
AlternatingItemTemplate
|
ITemplate |
[ Get , Set ] |
public |
Controls
|
ControlCollection |
[ Get ] |
public |
DataMember
|
String |
[ Get , Set ] |
public |
DataSource
|
Object |
[ Get , Set ] |
public |
DataSourceID
|
String |
[ Get , Set ] |
public |
EnableTheming
|
Boolean |
[ Get , Set ] |
public |
FooterTemplate
|
ITemplate |
[ Get , Set ] |
public |
HeaderTemplate
|
ITemplate |
[ Get , Set ] |
public |
Items
|
RepeaterItemCollection |
[ Get ] |
public |
ItemTemplate
|
ITemplate |
[ Get , Set ] |
public |
ItemType
|
String |
[ Get , Set ] |
public |
SelectMethod
|
String |
[ Get , Set ] |
public |
SeparatorTemplate
|
ITemplate |
[ Get , Set ] |
|
The Repeater is a data-bound container control that uses templates to define the rendering of its content. The control has no built-in layout or style; all HTML layout, formatting, and style tags must be explicitly declared within the control's templates.
At a minimum, every Repeater must define an ItemTemplate, though optional templates are available to customize the appearance of the list:
Template Name |
Description |
ItemTemplate |
Defines the content and layout of items within the list. This template is required. |
AlternatingItemTemplate |
If defined, this determines the content and layout of alternating ( zero-based odd-indexed ) items. If not defined, ItemTemplate is used. |
HeaderTemplate |
If defined, this determines the content and layout of the list header. If not defined, a header is not rendered. |
FooterTemplate |
If defined, this determines the content and layout of the list footer. If not defined, a footer is not rendered. |
SeparatorTemplate |
If defined, this is rendered between items ( and alternating items ). If not defined, a separator is not rendered. |
A Repeater has no built-in selection or editing support. The control includes the ItemCommand event, though, which can be used to handle events that are raised from the templates and passed to the control.
A Repeater binds its ItemTemplate and AlternatingItemTemplate to a data model referenced by its DataSource property. The HeaderTemplate, FooterTemplate, and SeparatorTemplate are not data-bound.
If the data source is not set, the Repeater is not rendered. If the data source is set but no data is returned, the control renders the HeaderTemplate and FooterTemplate, with no items.
For examples illustrating use of this control, see the individual member types of this class. For syntax information, see Repeater in ASP.NET Syntax for Web Controls.
Working with the Repeater Control