.NET
  Home arrow .NET arrow Page 3 - Creating the Home Page for a Simple Storef...
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 
 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? 
.NET

Creating the Home Page for a Simple Storefront with LINQ
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2008-05-06

    Table of Contents:
  • Creating the Home Page for a Simple Storefront with LINQ
  • ItemTemplate
  • A New Style
  • Preparing to Build the Product Page

  • 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

    Creating the Home Page for a Simple Storefront with LINQ - A New Style


    (Page 3 of 4 )

    As mentioned earlier, though, the layout of the items is a bit ugly, and the items don't come with any sort of a description beyond a picture. So, let's give the list of items a new style, and let's add more information.

    One of the things we'll want to display is the product's category, but to get the name of the category, we need access to the ProductCategory table. Open up AdventureWorks.dbml and drag the ProductCategory table on to the Designer:



    Visual Studio associates the tables, and we now have access to the name of the product's category.

    Let's add a few classes to our stylesheet:


    div.itemBoxSmall

    {

     background-color: #F0FFFF; /* Azure */

     border: solid 1px Orange;

     margin: 5px auto 0px auto;

     padding: 5px;

     text-align: left;

     width: 40%;

    }


    img.productImage

    {

     border: solid 1px Black;

     float: left;

     margin-right: 10px;

    }


    a.productLink

    {

     color: Black;

     font-weight: bold;

    }


    And now let's complete the style by recreating the ItemTemplate to show the new style, as well as a few extra fields:


    <ItemTemplate>

     <div class="itemBoxSmall">

     <img src="ProductPicture.aspx?id=<%#Eval("ProductID") %>"

     class="productImage" alt="Image of <%#Eval("Name") %>" />

     <a href="Product.aspx?id=<%#Eval("ProductID") %>" class="productLink">

     <%#Eval("Name") %>

     </a>

     <br />

     Category: <%#Eval("ProductCategory.Name") %><br />

     Color: <%#Eval("Color") %><br />

     List Price: <%#Eval("ListPrice", "{0:C}") %><br />

     </div>

    </ItemTemplate>


    There, now the list of latest items looks a bit more presentable, and the product's category, color and list price are all displayed, as well as the name of the product. Of course, feel free to add more to it if that suits you.

    More .NET Articles
    More By Peyton McCullough


       · Hello, all. This short series shows off some of the capabilities on LINQ by building...
     

    .NET ARTICLES

    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries
    - Introducing LINQ to SQL Designer using Visua...
    - Beginning LINQ to SQL Using Visual Studio 20...
    - Coding an AjaxPro.NET Based Search Engine fo...
    - Building an AjaxPro.NET Based Search Engine ...





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