Home   |   QuickStart Welcome   |   ASP.NET   |   Web Services   |   How Do I...?   
  |   I want my samples in...      

ASP.NET 2.0 Quickstart Tutorials


The Repeater control displays data items in a repeating list. Similar to DataList, the content and layout of list items in Repeater is defined using templates. At a minimum, every Repeater must define an ItemTemplate; however, the following optional templates may be used to customize the appearance of the list.

Template Name Description
ItemTemplate Defines the content and layout of items within the list. Required.
AlternatingItemTemplate If defined, the AlternatingItemTemplate determines the content and layout of alternating items. If not defined, ItemTemplate is used.
SeparatorTemplate If defined, the SeparatorTemplate is rendered between items (and alternating items). If not defined, a separator is not rendered.
HeaderTemplate If defined, the HeaderTemplate determines the content and layout of the list header. If not defined, header is not rendered.
FooterTemplate If defined, the FooterTemplate determines the content and layout of the list footer. If not defined, footer is not rendered.

Unlike DataList, Repeater has no built-in layout or styles. You must explicitly declare all HTML layout, formatting, and style tags within the templates of the control. For example, to create a list within an HTML table, you might declare the <table> tag in the HeaderTemplate, a table row (<tr> tags, <td> tags, and data-bound items) in the ItemTemplate, and the </table> tag in the FooterTemplate.

The following samples illustrate using a simple Repeater control.

VB Repeater1.aspx
Run Sample View Source

VB Repeater2.aspx
Run Sample View Source