One of the great additions to ASP.NET 2.0 is Master Pages. Master Pages help us build a consistent and maintainable UI throughout a site.
A master page can be created to hold those page elements that represent the common look and feel of a website. Various page elements that you might normally have added to each content page (banners, footers, menus, stylesheet links etc...) can instead be placed in the master page. When a new content page is created, the developer simply needs to link it to an existing master page. When that content page is rendered, the content page and its associated master page will be "merged" at runtime. The resulting markup will contain all of the elements from the master page as well as those elements defined in the content page.
Since it is possible for many site pages (or even all site pages) to refer to a single master page, it becomes very easy to create a common look and feel for all pages in a website. It is also possible for a single site to contain multiple master pages.
The ability to group common look, feel, and functionality into a master page also saves considerable time in maintenance. For instance if you need to change the logo at the top of a page, or the copyright information at the bottom, you will only need to do it in one place. Since each content page inherits all the master page attributes, the pages are all updated one the one edit to the master page. Master pages can save development time.
To setup a page to use a master page, add a MasterPageFile reference to the @Page directive. Alternatively, to apply a master page at the site level (only have to specify it once), use the <pages> element to set the masterPageFile to the path of the master page.
Revision number 11, Thursday, August 11, 2011 6:26:53 PM by bryan strader
You must Login to comment.
Sat, Mar 29, 2008 12:22 PM
This was an interesting article that can help making webapplications easier.
Fri, Dec 26, 2008 8:40 AM
Great Job,, Master Pages are useful in web apps.
Sat, Feb 16, 2008 5:45 AM