Adding a Page that Uses The Master Page

You will now create a Web page that is based on the Master Page you just added to your project.

1. In the Solution Explorer right-click the project and select Add New Item. In the Add New Item dialog select Web Form.For Name enter "ContentPage.aspx". Uncheck Place code in separate file and check Select master page, then click Add.

2. In the Select a Master Page dialog, select MasterPage.master and click OK.

3. Click Design to view the design surface of your new Web page. Notice that everything except the Content control is grayed out.  You can only change the content within the enabled control. Enter some text, such as "This is custom content for this Web page". Then press F4 and change the Content control's ID to "bodyContent".

4. Click Source. Notice that there is very little code in this page. All you have is a reference to the master page and the Content control tag, with the content you just entered.

5. Press F5 to run the application.

 

Notice how easy it was to create a Web page that uses a Master Page and an easily configurable dynamic navigation menu.

6. Close your browser.

 
HyperLink HyperLink

Powered By ASP.NET v2.0