Web sites look better and are less confusing to users when they have a consistent “look and feel” as you move from page to page. ASP.NET 2.0 facilitates creating consistency with master pages .
A master page provides shared HTML, controls, and code that can be used as a template for all of the pages of a site. The O’Reilly web site (http://www.oreilly.com) is a good example of a site that could be implemented using a master page. With a master page, the logo (the O’Reilly tarsier) and an image (the O’Reilly header) can be shared across multiple pages.
To get started with master pages, you’ll take the following steps:
Create a new web site.
Add a master page to the site.
Add content pages based on the master page.
To begin, create a new web site and call it
MasterPages. Once the new site opens, right-click on the project and choose Add New Item. In the dialog box that opens, choose Master Page, and name your master page SiteMasterPage.master, as shown Figure 10-1.
asp:contentplaceholder control has been added for you in the new page. It is this placeholder that will be filled by the content of each of the pages that use this master page.
Within the master page itself you may add anything you like surrounding the
contentplaceholder. Whatever you add will be displayed on all pages that use the master page.