<%@ Page Language="c#" masterpagefile="~/masterpage.master" Inherits="Microsoft.Samples.SqlServer.ShoppingCart" CodeFile="ShoppingCart.aspx.cs" %> <%@ Register TagPrefix="AdventureWorks" TagName="AlsoBought" Src="_AlsoBought.ascx" %> <asp:content id="Content1" contentplaceholderid="ContentPlaceHolder1" runat="server"> <!-- ===================================================================== File: ShoppingCart.aspx for Adventure Works Cycles Storefront Sample Summary: Displays the contents of the shopping cart and provides the opportunity to update the cart or checkout Date: June 16, 2003 ===================================================================== This file is part of the Microsoft SQL Server Code Samples. Copyright (C) Microsoft Corporation. All rights reserved. This source code is intended only as a supplement to Microsoft Development Tools and/or on-line documentation. See these other materials for detailed information regarding Microsoft code samples. THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. ======================================================= --> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td class="ContentHead"> <img align="left" height="32" width="60" src="images/1x1.gif">Shopping Cart <br> </td> </tr> </table> <img align="left" height="4" width="110" src="images/1x1.gif"> <font color="red"> <asp:Label id="MyError" cssclass="ErrorText" EnableViewState="false" runat="Server" /> </font> <br> <img align="left" height="15" width="24" src="images/1x1.gif" border="0"> <asp:panel id="DetailsPanel" runat="server"> <img height="1" src="images/1x1.gif" width="50" align="left"> <table height="100%" cellSpacing="0" cellPadding="0" width="550" border="0" runat="server"> <tr vAlign="top"> <td width="550"> <asp:DataGrid id="MyList" runat="server" AutoGenerateColumns="false" DataKeyField="Quantity" AlternatingItemStyle-CssClass="CartListItemAlt" ItemStyle-CssClass="CartListItem" FooterStyle-CssClass="CartListFooter" HeaderStyle-CssClass="CartListHead" ShowFooter="true" Font-Size="8pt" Font-Names="Verdana" cellspacing="0" cellpadding="4" GridLines="Vertical" BorderColor="black"> <Columns> <asp:TemplateColumn HeaderText="Product ID"> <ItemTemplate> <asp:Label id="ProductID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ProductID") %>' /> </ItemTemplate> </asp:TemplateColumn> <asp:BoundColumn HeaderText="Product Name" DataField="Name" /> <asp:BoundColumn HeaderText="Model" DataField="ProductNumber" /> <asp:TemplateColumn HeaderText="Quantity"> <ItemTemplate> <asp:TextBox id="Quantity" runat="server" Columns="4" MaxLength="3" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity") %>' width="40px" /> <asp:RequiredFieldValidator ControlToValidate="Quantity" Display="dynamic" Font-Names="verdana" Font-Size="9pt" ErrorMessage="'Quantity' must not be left blank." runat="server" id="RequiredFieldValidator1"></asp:RequiredFieldValidator> <asp:RangeValidator ControlToValidate="Quantity" MinimumValue="0" MaximumValue="999" Type="Integer" Display="Dynamic" Font-Names="verdana" Font-Size="9pt" ErrorMessage="'Quantity' must be an integer between 0 and 999" Runat="server" ID="RangeFieldValidator1"></asp:RangeValidator> </ItemTemplate> </asp:TemplateColumn> <asp:BoundColumn HeaderText="Price" DataField="ListPrice" DataFormatString="{0:c}" /> <asp:BoundColumn HeaderText="Subtotal" DataField="ExtendedAmount" DataFormatString="{0:c}" /> <asp:TemplateColumn HeaderText="Remove"> <ItemTemplate> <center> <asp:CheckBox id="Remove" runat="server" /> </center> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid><IMG height="1" src="Images/1x1.gif" width="350"> <SPAN class="NormalBold">Total: </SPAN> <asp:Label cssclass="NormalBold" id="totalLabel" runat="server" EnableViewState="false"></asp:Label><BR> <br /> <img height="1" src="Images/1x1.gif" width="60"> <asp:imagebutton id="UpdateButton" runat="server" ImageURL="images/update_cart.gif" onclick="UpdateButton_Click"></asp:imagebutton><IMG height="1" src="Images/1x1.gif" width="15"> <asp:imagebutton id="CheckoutButton" runat="server" ImageURL="images/final_checkout.gif" onclick="CheckoutButton_Click"></asp:imagebutton><BR> <br /> <img height="30" src="images/1x1.gif"> <AdventureWorks:AlsoBought ID="AlsoBoughtList" runat="server" /> </td> </tr> </table> </asp:panel> </asp:content>