Template Name | Description |
---|---|
ItemTemplate | It is the required field of the repeater. It defines the content and layout of the items. |
AlternatingItemTemplate | It determines the content and layout of alternative items. If not defined, it uses ItemTemplate. |
SeparatorTemplate | The SeparatorTemplate is rendered between items (and alternating items). If not defined, a separator is not rendered. |
HeaderTemplate | The SeparatorTemplate is rendered between items (and alternating items). If not defined, a separator is not rendered. |
HeaderTemplate | The HeaderTemplate determines the content and layout of the list header. If not defined, header is not rendered. |
FooterTemplate | The FooterTemplate determines the content and layout of the list footer. If not defined, footer is not rendered. |
<html>
<head>
<script language="VB" runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack Then
Dim values As ArrayList = New ArrayList()
values.Add(New PositionData("Sachin ", "Cricket"))
values.Add(New PositionData("Saina ", "Badminton"))
values.Add(New PositionData("Mary Kom", " Boxing"))
Repeater1.DataSource = values
Repeater1.DataBind()
Repeater2.DataSource = values
Repeater2.DataBind()
End If
End Sub
Class PositionData
Dim m_name As String
Dim m_sport As String
Public Sub New(name As String, sport As String)
MyBase.New
m_name = name
m_sport = sport
End Sub
ReadOnly Property Name As String
Get
Return m_name
End Get
End Property
ReadOnly Property sport As String
Get
Return m_sport
End Get
End Property
End Class
</script>
</head>
<body>
<h3><font face="Verdana">Repeater Example</font></h3>
<form runat=server>
<b>Repeater1:</b>
</p>
<p>
<asp:Repeater id=Repeater1 runat="server">
<HeaderTemplate>
<table border=1>
<tr>
<td><b>Name</b></td>
<td><b>Sport</b></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td> <%# DataBinder.Eval(Container.DataItem, "Name") %> </td>
<td> <%# DataBinder.Eval(Container.DataItem, "sport") %> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</p>
<p>
<b>Repeater2:</b>
</p>
<p>
<asp:Repeater id=Repeater2 runat="server">
<HeaderTemplate>
<b>Name & Sport:</b>
</HeaderTemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Name") %><br /> (<%# DataBinder.Eval(Container.DataItem, "sport") %>)
</ItemTemplate>
<SeparatorTemplate>, </SeparatorTemplate>
</asp:Repeater>
</p>
</form>
</body>
</html>