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  
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? 
ASP.NET

How to Use Master Pages
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 23
    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

    - ASP.NET DotNetNuke Installation with Visual ...
    - Using ASP.NET with a MySQL Database
    - Using ASP.NET with an MS Access Database
    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 12 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek