Skip Navigation LinksASP.Net 2.0 Training : ASP.Net Repeater Control
Banner for ASP.Net 2.0 training classes in Visual Basic 2005 

Skip Navigation Links
Visit my other site:

certification training

Free Flash tutorials and training

Free Dreamweaver Video Tutorials

Free PHP Training

Visual Basic Windows Training

If you like this site please link to it

The Repeater Control

The repeater control is driven completely by templates. This allows you to output the control anyway you want it.

Templates of the repeater control

  • ItemTemplate
    • Required to display data
    • Formats each item from the datasource
  • HeaderTemplate
    • Formats the content before the items from the dataSource
  • FooterTemplate
    • Formats the content after the items from the dataSOurce
  • AlternatingItemTemplate
    • Formats every other item from the dataSource
  • SeperatorTemplate
    • Formats between each item from the dataSource

Displaying Data

Use the itemTemplate to display data
This template is the only required template, all others are optional.

  • Start a new WebSite in Visual Studio 2005
  • Add a webform
  • Drag a DataSource control to the page and configure it to a dataSource
  • Drag a repeater control to the page
  • Click the smart tag and configure it to the dataSource control

  • Open the Source code view
  • Type a    

You choices show up in intellisense

  • Select ItemTemplate

Now you can add any formatting code you want as well as fields from the database


The headerTemplate and footerTemplate can be used to start and stop tables or add other items to the beginning and the end of your data

Add an AlternatingItemTemplate tag
The order you declare the templates does not matter

Copy the same content from the itemtemplate

Add a class to the <tr> tag in the alternatingItemTemplate

Add a style in the head of the document
<style type=”text/css”>

The seperatorTemplate is used to add items between each data item


  • DataBinding
    • When repeater control bound to its dataSOurce
  • ItemCommand       
    • When a control in the repeaterControl raises an event
  • ItemCreated
    • When each repeatercontrol item is created
  • ItemDataBound
    • When each item is bound

      ASP.Net 2.0 tutorials & training