Create a page from a master page

A content page is a page based on a master page. When a user views a content page in the browser, the user sees all the content from the master page, plus all the content you add in the content controls on the content page. Unlike HTML pages based on a Dynamic Web Template (DWT), however, a page based on a master page does not include the master page content in the actual file on the server, so you cannot see it in Code view. It is displayed for you in Design view, but it is not editable.

To create a page based on a master page in the Folder List task pane

  • In the Folder List task pane, right-click the master page, and select New from Master Page.

To create a page based on a master page by using the New dialog box

  1. On the File menu, click New.

  2. In the Page tab of the New dialog box, select General or ASP.NET in the list at the left and Create from Master Page in the center list.

  3. Set the default programming language for your page in the Programming Language dropdown in the Options area.

  4. In the first Select a Master Page dialog box, choose either Use default Master Page (if one is specified in the web.config file for the site) and click OK or select the Specific Master Page option button and click Browse.

    Note

    For information about setting a default master page in a web.config file, see the MSDN topic How to: Create Web.config Files (Visual Studio).

  5. If you clicked Browse, select the desired master page in the second Select a Master Page dialog box and click OK.

    Note

    If you don't need to set the Programming Language for the page, you can open the Select a Master Page dialog box by resting your pointer on New on the File menu to expand the submenu, and then click Create from Master Page.

    You can also attach a master page to an .aspx file that was not created based on the master page.

To attach a master page to an .aspx file

  1. On the Format menu, click Master Page, and then click Attach Master Page.

  2. In the Select a Master Page dialog box, choose either Use default Master Page (if one is specified in the web.config file for the site) and click OK or select the Specific Master Page option button and click Browse.

  3. If you clicked Browse, locate and click the master page that you want in the Select a Master Page dialog box and then click OK.

    Once you have created a page based on a master page, you can add content to the Content controls on the page. For details, see Add content to a content page.

See also

Concepts

ASP.NET master pages overview

Create a master page

Add content to a content page

Master Page toolbar