ASP.NET
  Home arrow ASP.NET arrow How to Use Master Pages
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 
Mobile Linux 
App Generation ROI 
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? 
ASP.NET

How to Use Master Pages
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 16
    2005-12-01

    Table of Contents:
  • How to Use Master Pages
  • How to create a master page
  • The aspx code for a new master page
  • The aspx code for the Halloween Store master page
  • The code-behind file for the master 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


    How to Use Master Pages


    (Page 1 of 5 )

    Looking for an easy way to include banners, navigation menus, and content from other pages within an application? You might want to use master pages. This article, the first of two parts, introduces you to their creation. It is excerpted from chapter three of the book Murach’s ASP.NET 2.0 Upgrader’s Guide: VB Edition, written by Anne Boehm and Joel Murach (Murach, 2005; ISBN: 1-890774-36-7).

    How to create master pages

    A master page is a page that provides a framework within which the content from other pages can be displayed. Master pages make it easy to include banners, navigation menus, and other elements on all of the pages in an application. In the topics that follow, you’ll learn how to create master pages in your ASP.NET applications.

    A is a page that provides a framework within which the content from other pages can be displayed. Master pages make it easy to include banners, navigation menus, and other elements on all of the pages in an application. In the topics that follow, you’ll learn how to create master pages in your ASP.NET applications.

    An introduction to master pages

    Figure 3-1 shows the basics of how master pages work. As you can see, the page that’s actually sent to the browser is created by combining elements from a master page and a content page. The content page provides the content that’s unique to each page in the application, while the master page provides the elements that are common to all pages. In this example, the master page (MasterPage.master) provides a banner at the top of each page, a simple navigation menu at the side of each page, and a message that indicates how many days remain until Halloween at the bottom of each page.

    In addition, the master page contains a content placeholder that indicates where the content from each content page should be displayed. In this example, the content page is the Order.aspx page, and its content is displayed in the content placeholder in the central portion of the master page.

    Notice that the name of the content page is Order.aspx, the same as the Order page that you saw in chapter 2. In other words, when you use master pages, the individual pages of your web application become the content pages. You’ll learn how to create content pages or convert existing ASP.NET pages to content pages in figure 3-6.

     

    The Cart application with a master page (figure 3-1)
     

    Description

    • A master page provides a framework in which the content of each page on a web site is presented. Master pages make it easy to create pages that have a consistent look.
    • The pages that provide the content that’s displayed in a master page are called content pages.
    • The content of each content page is displayed in the master page’s content placeholder.

    More ASP.NET Articles
    More By Murach Publishing


       · This article is an excerpt from the book "Murach’s ASP.NET 2.0 Upgrader’s Guide: VB...
       · I would love to read the article if the sample images weren't dead links. I'm not...
       · Hi,I like the article on Master pages. I want to ask one question whether I can...
     

    Buy this book now. This article is excerpted from chapter three of the book Murach’s ASP.NET 2.0 Upgrader’s Guide: VB Edition, written by Anne Boehm and Joel Murach (Murach, 2005; ISBN: 1-890774-36-7). Check it out today at your favorite bookstore. Buy this book now.

    ASP.NET ARTICLES

    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - 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





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