How to: Create Content Pages for an ASP.NET Master Page
A content page is an ASP.NET Web page that is associated with a master page. The master page establishes a layout and includes one or more ContentPlaceHolder controls for replaceable text and controls. The content page includes only the text and controls that are merged at run time with the master page's ContentPlaceHolder controls. For more information, see ASP.NET Master Pages Overview.
Visual Web Developer provides a number of ways to create a content page, including a shortcut if you are editing a master page. You can also create a content page by starting with a blank page and adding the appropriate directive.
After creating a content page, you can create custom content that corresponds to each ContentPlaceHolder on the master page. Alternatively, you can explicitly choose to allow the master page's default content to be displayed.
To add a content page in Visual Web Developer
In Solution Explorer, right-click the name of the Web site and then click Add New Item.
In the Visual Studio installed templates list, click Web Form.
Select the Select master page check box, and then click Add.
The Select a Master Page dialog box appears.
In the Contents of Folder box, click the master page that you want to associate with the page you are creating, and then click OK.
To create a content page while editing a master page
With the master page open in the editor, right-click anywhere on the page and click Add Content Page.
Visual Web Developer creates a new content page named Defaultx.aspx, where x is a sequential number.
To assign a different name to the content page, close it, right-click the name in Solution Explorer, and click Rename.
To create a content page declaratively
Create a new ASP.NET Web page.
Switch to Source view.
Remove everything from the page except the @ Page directive.
The @ Page directive might include additional attributes, such as CodeFile and Inherits, which are not shown here.
When you create a content page in Visual Web Developer, the designer creates, by default, a Content control for each ContentPlaceHolder control defined in the master page. You can add custom content to each Content control or explicitly revert to the default content, if any, that is defined in the master page.
To add content to the page in Design view
In Design view, drag controls or elements onto the Content control, or click the control and begin typing.
To display default master page content in Design view
Right-click the Content control and click Show Smart Tag.
Click Default to Master's Content.
Visual Web Developer displays the Content control with the default content defined in the master page. The title bar of the Content control includes the term (Master) to indicate that it is displaying information from the master page, not the content page.
In this mode, you cannot edit the contents displayed in the Content control.
To create custom content, right-click the control, click Show Smart Tag, and then click Create Custom Control to put the control back into edit mode.
The designer removes the Content control from the content page's markup.