<%@ Control Language="JScript" %> <%@ Import Namespace="System.Data.SqlClient" %> <script runat="server"> public var ProductID : int ; //******************************************************* // // The Page_Load event on this page is used to obtain // from a database a collection of other products // that customers who purchased a product "also bought". // //******************************************************* function Page_Load(sender: Object, e: EventArgs) : void { // Obtain list of products that people who "also bought" an item have purchased. Databind to list control var productCatalogue : IBuySpy.ProductsDB = new IBuySpy.ProductsDB(); alsoBoughtList.DataSource = productCatalogue.GetProductsAlsoPurchased(ProductID); alsoBoughtList.DataBind(); // Hide the list if no items are in it if (alsoBoughtList.Items.Count == 0) { alsoBoughtList.Visible = false; } } <table width="95%" cellpadding="0" cellspacing="0" border="0"> <tr> <td> <asp:Repeater ID="alsoBoughtList" runat="server"> <HeaderTemplate> <tr> <td class="MostPopularHead"> Customers who bought this also bought </td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td bgcolor="#d3d3d3"> <asp:HyperLink class="MostPopularItemText" NavigateUrl='<%# "ProductDetails.aspx?ProductID=" + DataBinder.Eval(Container.DataItem, "ProductID")%>' Text='<%#DataBinder.Eval(Container.DataItem, "ModelName")%>' runat="server" /> <br> </td> </tr> </ItemTemplate> <FooterTemplate> <tr> <td bgcolor="#d3d3d3"> </td> </tr> </FooterTemplate> </asp:Repeater> </td> </tr> </table>