ASP.NET
  Home arrow ASP.NET arrow Page 2 - Building a Simple Storefront with LINQ
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM developerWorks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Building a Simple Storefront with LINQ
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2008-04-29

    Table of Contents:
  • Building a Simple Storefront with LINQ
  • ProductCategory Table
  • Creating the Master Page
  • Displaying Product Pictures

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Building a Simple Storefront with LINQ - ProductCategory Table


    (Page 2 of 4 )

    Next, take a look at the ProductCategory table, which stores the various categories that products may be arranged in:



    The table is simple enough. Each category has a ProductCategoryID field which identifies it, along with a Name field. No surprises. What interests us here is the ParentProductCategoryID field. Top-level categories won't have any value in this field (which is why "Allow Nulls" is checked for this field), but a subcategory will have the ProductCategoryID of its parent category in this field. Our sample database only has two category levels, top-level categories, which only contain other categories, and subcategories, which contain the products, so it won't be too difficult to work with this table.

    Recall how the Product table defined a ProductModelID field. Each product can be modeled after a product model. For example, say we have a product model called Mountain-100, representing a mountain bike. From this model, we can have, for example, various colors. A product, then, might be named Mountain-100 Silver, or Mountain-100 Black. Let's look at the ProductModel table:


    Each model has a ProductModelID field and a Name field, both serving to identify it, as well as a CatalogDescription field. We won't be using this field. Instead, we'll be using descriptions from the ProductDescription table:


    The ProductModelProductDescription table provides a link between the ProductModel table and the ProductDescription table by matching a ProductModelID with a ProductDescriptionID:



    The Plan

    We're not building anything complex here-only enough to demonstrate LINQ through ASP.NET. So, our plan will be quite simple. We'll create a master page to unify the site's layout. The master page will just feature the title of our site, Adventure Works Cycles. Then, we'll create a home page that displays information about some of the latest items added to the database. However, this information will have to include a picture of the item, so we'll need to create a page that displays a given item's picture.

    Next, we'll create a page where a user can browse all of the products in the store. One ListBox will provide a list of top-level categories from which the user can choose, and another ListBox will provide a list of subcategories corresponding to the chosen top-level category. When a subcategory is shown, a list of all the items in that category will be displayed.

    However, displaying all of the products in a given category might not be what we want, so after we complete the basic product browse functionality, we'll create an alternative browse page, this time browsing all of the product models in a given category.

    More ASP.NET Articles
    More By Peyton McCullough


       · Thanks a lot for the article. I was looking for similar example. Waiting for the...
       · Thanks for the comment, and the next article is now posted.Anyway, for everyone...
       · Not sure if I'm missing something obvious. I can't seem t find the link for the part...
       · Sorry, it accidentally got put in the .NET section rather than the ASP.NET section....
     

    ASP.NET ARTICLES

    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ
    - Developing a Dice Game Using ASP.NET Futures...
    - Completing an ASP.NET AJAX Server-Centric Ba...
    - Information Management for an ASP.NET AJAX S...
    - Comment and Order Management for an ASP.NET ...
    - Back-end Management Tasks for an ASP.NET AJA...
    - User Information Management for an ASP.NET A...
    - Adding Comments and Search to an ASP.NET AJA...
    - Order-Related Modules for an ASP.NET AJAX Se...
    - User and Role Management for an ASP.NET AJAX...
    - Programming an ASP.NET AJAX Server-Centric B...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway