The Cart page displays the contents of the cart and allows you to remove items from the cart. It also provides a button to purchase the items in the cart, which would, of course, take you to the Purchase page.
Of course, a full-featured cart would provide much more functionality than the simple cart shown here. For example, your fully featured commercial site might uses personalization to remember what was added to the cart in previous sessions and restore that information in a new session. It would almost certainly allow the user to change the quantity ordered of a given item, not to mention things such as size or color.
Open Cart.aspx. Drag a
SqlDataSource control onto the content area of the page. Set its ID
sqlCart. Configure it similar to the
SqlDataSource in Example 10-8. Here is the markup for the
control. It looks complex, but really it is a straightforward
SELECT statement against the
Production.Product table, with five joins:
<asp:SqlDataSource ID="sqlCart" runat="server" ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString %>" SelectCommand= "select product.ProductID, product.Name, product.ProductNumber, product.Color, subcat.Name as SubcategoryName, cat.Name as CategoryName, description.Description from Production.Product product join Production.ProductSubcategory subcat on product.ProductSubcategoryID = subcat.ProductSubcategoryID join Production.ProductCategory cat on subcat.ProductCategoryID = cat.ProductCategoryID join Production.ProductModel ...