<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<head>
<title>Repeater Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server" src="fetchData_sql.cs" />
<script language="C#" runat="server">
void Page_Load ( object src, EventArgs e ) {
string query = "SELECT * FROM Titles";
myRepeater.DataSource = fetchData ( query );
myRepeater.DataBind ( );
}
</script>
</head>
<body style="margin:0">
<!-- #include file="dl_header.inc" -->
<form runat="server">
<asp:repeater id="myRepeater" runat="server">
<headertemplate>
<table width="100%" cellspacing=1 cellpadding=3 style="font:9pt verdana">
<tr style="background-color:#ddc">
<th>Title</th>
<th>Title ID</th>
<th>Type</th>
<th>Publisher ID</th>
<th>Price</th></tr>
</headertemplate>
<itemtemplate>
<tr style="background-color:whitesmoke; height:17pt">
<td><%# Eval ( "title" ) %></td>
<td><%# Eval ( "title_id" ) %></td>
<td><%# Eval ( "type" ) %></td>
<td><%# Eval ( "pub_id" ) %></td>
<td><%# Eval ( "price", "{0:c2}" ) %></td></tr>
</itemtemplate>
<footertemplate>
</table>
</footertemplate>
</asp:repeater>
<!-- #include file="dl_footer.inc" -->
</form>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>