.NET
  Home arrow .NET arrow 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


    (Page 1 of 4 )

    In the last article, we laid out the plans for a simple storefront for the Adventure Works Cycles sample database. We briefly examined the database structure, and created a master page to unify the look of our new web site. We also created a page that would display the appropriate image given a ProductID through the query string. In this article, we'll continue with the construction of the storefront.

    Creating the Home Page

    Let's create the store's home page. On this page will be a short welcome messages, a link to the product browse page, and then a short list of the latest products. We'll tackle the basic structure of the page first, and then we can move on to the meat of the page: using LINQ with ASP.NET. Create a Default.aspx page. Be sure to set its master page to MasterPage.master, which we created in the last article. The page will be created with a simple Content control. Here's the page without the latest items part:

    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" 
    AutoEventWireup="true" CodeFile="Default.aspx.cs" 
    Inherits="_Default" Title="Adventure Works Cycles" %>


    <asp:Content ID="Content1" ContentPlaceHolderID="content" 
    Runat="Server">

    <p>Welcome to Adventure Works Cycles, your source for cycles and cycling accessories.</p>

    <p><a href="Browse.aspx">Browse Products</a></p>

    <p>Check out some of our latest items:</p>


    </asp:Content>


    Now we need a control that will display the latest items for us. Let's go with a ListView control, which is relatively new and easy to work with:


    <asp:ListView ID="LatestItemsView" runat="server">

    </asp:ListView>


    Before the ListView becomes operational, we need to provide it with a few templates. First is the LayoutTemplate, which defines the “master layout,” if you will, of the ListView. Place this inside of the ListView tags:


    <LayoutTemplate>

     <p>Here are some of our latest items:</p>

     <asp:PlaceHolder ID="itemPlaceholder" runat="server" />

     </LayoutTemplate>


    Notice how we provide a PlaceHolder control here. It's a placeholder for the list of items, and it's a necessary part of LayoutTemplate. It also must have the name “itemPlaceholder” in order to work.

    More .NET Articles
    More By Peyton McCullough


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

    .NET ARTICLES

    - 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
    - Grouping and Aggregating When Querying LINQ ...
    - 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...





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