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.
Next: How to create a master page >>
More ASP.NET Articles
More By Murach Publishing
|
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.
|
|