Wednesday 9 April 2014

Repeater Control example in asp.net

Repeater Control is a control which is used to display the repeated list of items.

Repeater Control is used to display repeated list of items that are bound to the control and it’s same as gridview and datagridview.
Repeater control is lightweight and faster to display data when compared with gridview and datagrid. By using this control we can display data in custom format but it’s not possible in gridview or datagridview and it doesn’t support for paging and sorting.  
The Repeater control works by looping through the records in your data source and then repeating the rendering of it’s templates called item template. Repeater control contains different types of template fields those are
1) itemTemplate 
2) AlternatingitemTemplate 
3) HeaderTemplate 
4) FooterTemplate
5) SeperatorTemplate
 
ItemTemplate: ItemTemplate defines how the each item is rendered from data source collection.

AlternatingItemTemplate: AlternatingItemTemplates is used to change the background color and styles of AlternatingItems in DataSource collection 

HeaderTemplate: HeaderTemplate is used to display Header text for DataSource collection and apply different styles for header text.

FooterTemplate: FooterTemplate is used to display footer element for DataSource collection

SeparatorTemplate: SeparatorTemplate will determine separator element which separates each Item in Item collection. Usually, SeparateTemplate will be <br> html element or <hr> html element.

No comments:

Post a Comment