O'Reilly logo

Learning ASP.NET 2.0 with AJAX by Dan Hurwitz, Jesse Liberty, Brian MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cart Page

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.

Tip

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 to 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required