<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RepeaterExample1.aspx.cs" Inherits="Repeater.RepeaterExample1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Repeater Example</title>
</head>
<body bgcolor="#ffcc66">
<h3>This example demonstrates dynamically displayed data using
a Repeater control.</h3>
The Repeater control that is used to repeat or generate a
table row for each element contained in the datasource.
<div>
<form id="form1" runat="server">
<table>
<tr style="color: #CC3300;">
<th>Product
ID</th>
This manually binds the “ProductNumber”
data field to the Text Property of the label for each row that is
generated. The value displayed in this control’s Text Property for each
generated row will be the value of the “ProductNumber”
field for a specific element in the datasource.
<th>Description</th>
<th>Price</th>
<th>Quantity
in stock</th>
</tr>
<asp:Repeater ID="rptProducts" runat="server">
<ItemTemplate>
<tr>
<td>
<asp:Label ID="lblProductID" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "ProductNumber") %>'></asp:Label>
</td>
<td>
<asp:Label ID="lblDescription" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'></asp:Label>
</td>
<td>
<asp:Label ID="lblPrice" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "Price", "{0:c}") %>'></asp:Label>
This method does one-way data binding.
</td>
<td>
Shorthand way to bind data from a datasource.
The main difference is that this has the capability of two-way data
binding.
<asp:Label ID="lblQOH" runat="server" Text='<%# Bind("QOH") %>'></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</form>
</div>
</body>
</html>