When creating a website, designers strive to have all pages share a common look and feel. This includes a consistent color and font scheme along with consistent user interface elements. For example, most designers strive to have navigation controls and login-related controls available on all pages throughout the site. Implementing a consistent, sitewide design with ASP.NET is easy and hassle-free, thanks to master pages. A master page contains both sitewide user interface elements along with regions that can be customized on a page-by-page basis. These editable regions are indicated by ContentPlaceHolder controls.
Once a master page has been created, an ASP.NET page can inherit from this master page. This is accomplished by selecting the master page from a list of the site's master pages when adding the ASP.NET page to the project. When an ASP.NET page is associated with a master page, the ASP.NET page contains a Content Web control for each of the ContentPlaceHolder controls in the master page. The content placed in these editable regions is fused with the master page's content when the ASP.NET page is viewed through a browser. Because the melding of master page and ASP.NET page is done when the page is requested, any changes to a master page are automatically and instantly reflected in those pages that inherit from the master page.
As we saw throughout this chapter, Visual Web Developer provides rich design-time support for master pages. Creating a master page is tantamount to creating an ASP.NET page and can be done entirely through the Design view. When an ASP.NET page is associated with a master page, the Design view shows the master page's sitewide content grayed out, indicating that it cannot be modified on this page.