<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<head>
<title>DataBinding to the HtmlAnchor Control</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>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2>DataBinding to the <span class="hilite">HtmlAnchor Control</span></h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<div align="center">
<form runat="server">
<asp:repeater id="myRepeater" runat="server">
<headertemplate>
<table width="88%" cellspacing=1 cellpadding=5 style="font-size:10pt">
<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:#efefef">
<td><a href='<%# Eval ( "title_id", "details_title.aspx?titleid={0}" ) %>'>
<%# Eval ( "title" ) %></a></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>
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>