ASP.NET - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

ASP.NET Repeater

ASP.NET Repeater

shape Description

In ASP.Net, Repeater is used to show multiple records in a repeated manner. Apart from GridView, one can use this Repeater control to show multiple values, coming from a data source like database, XML file etc. and can also use “test.xml” as data source for the repeater control. [html]<?xml version="1.0" encoding="utf-8" ?> <technologies> <technology> <text>ASP.NET</text> <value>A</value> </technology> <technology> <text>JAVA</text> <value>J</value> </technology> <technology> <text>HTML</text> <value>H</value> </technology> </technologies>[/html] Use one DataSet, for which the data source is “test.xml” and at page load this DataSet will be loaded with the values and use “System.Data” namespace here.

shape Data bind

Bind the data for a repeater like below screenshot At the page load, one will get the screen with the items entered in the xml file. Basic structure of a repeater is mentioned below. [html] <asp:Repeater id="spRepeater" runat="server"> <HeaderTemplate> .... </HeaderTemplate> <ItemTemplate> .... </ItemTemplate> <FooterTemplate> .... </FooterTemplate> </asp:Repeater> [/html] This has to be written between form tags.