Master Pages

Most Web sites share a common look and feel on almost every Web page. Typically this is implemented via separate files, such as for a header and footer. ASP.NET v1.x supported this with user controls. However, you needed to reference these controls on every page, and there was no design-time support for seeing how the page would look when rendered. You simply saw a gray box representing the user control.

VWD introduces a feature called Master Pages, a flexible page-template based system that allows you to "skin" and control the layout of your entire Web site by modifying only one template. This type of "visual inheritance" greatly reduces the maintenance and overall complexity of your Web site. It also gives you the type of WYSIWYG support you would expect in the Design view.

A Master Page is a just another type of file that you add to your project. It has a .master extension. You can place any control that you want on a Master Page.  Every page that inherits from the Master Page will automatically use the same controls inserted on the Master Page.  The content of a child page is placed into a ContentPlaceHolder control.  The net result is the entire format and layout of your Web site can be maintained by changing a single file.

In this next series of lessons you will create a simple Master Page, add new Web pages that inherit from the Master Page, and convert existing Web pages to use the Master Page.  Additionally, you will use one of the new navigational controls in ASP.NET 2.0.

 

 
HyperLink HyperLink

Powered By ASP.NET v2.0