<html>
<head>
<title>Binding a Data Source to a DataList Control</title>
<link rel="stylesheet" href="/shared/netdemos.css">
</head>
<body>
<!-- #include virtual="~/shared/top.inc" -->
<div class="header"><h2>Binding a DataList to a Data Source Control</h2></div>
<hr size=1 width=92%>
<div align="center">
<asp:datalist id="myList" runat="server"
datasourceid="products"
width=90% cellpadding=10
repeatcolumns=2
enableviewstate=false>
<itemtemplate>
<p style="font:bold 13pt arial; color:navy; margin-bottom:5">
<%# Eval ( "Productname" ) %>
</p>
<b>Product Code:</b> <%# Eval ( "ProductCode" ) %><br>
<b>Category:</b> <%# Eval ( "ProductType" ) %><br>
<b>Description:</b> <%# Eval ( "ProductDescription" ) %><br>
<b>Price:</b> <%# Eval ( "UnitPrice", "{0:c}" ) %>
</itemtemplate>
</asp:datalist>
<asp:accessdatasource id="products" runat="server"
datafile="~/app_data/dbtutor.mdb"
selectcommand="SELECT ProductType, ProductCode, Productname, ProductDescription, UnitPrice FROM Products"
datasourcemode="DataReader" />
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>