.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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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


    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

    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT