You can use your master page created as described in the article: How to create a simple master page in ASP.NET in another page by adding the MasterPageFile attribute to the Page directive. This attribute indicates the filename of the master page you want to use:

In VB.NET

<%@ Page Language=”VB” MasterPageFile=”./SiteTemplate.master” … %>

In C#

<%@ Page Language=”C#” MasterPageFile=”./SiteTemplate.master” … %>

Important notes:

1. The MasterPageFile attribute begins with the path ./ to specify the root website folder.

2. Content pages define the content that is inserted in one or mode ContentPlaceHolder controls.

3. A content page doesn’t define the page, because the outer shell is already provided by the master page. You cannot include elements such as <html>, <head>, and <body> because you already defined them in the master page.

You can provide content for a ContentPlaceHolder, by using another specialized control, called Content. Both controls have a one-to-one relationship. For each ContentPlaceHolder in the master page, the content page supplies a matching Content control. ASP.NET links the Content control to the appropriate ContentPlaceHolder by matching the ID of the ContentPlaceHolder with the Content.ContentPlaceHolderID property of the corresponding Content control. If you create a Content control that references a nonexistent ContentPlaceHolder, you’ll receive an error at runtime.

You can create a new content page by following the next steps in Visual Studio 2010:

1. Select Website ➤ Add New Item from the menu.

2. Select Web Form, click the Select Master Page check box, and click OK.

3. Choose a master page file from you current web project when Visual Studio prompts you.

4. Visual Studio automatically creates a Content control for every ContentPlaceHolder in the master page.

 

 

Adding a new content page

Adding a new content page

 

Choosing a master page

Choosing a master page

In VB.NET

<%@ Page Title=”” Language=”VB” AutoEventWireup=”false” MasterPageFile=”~/SiteTemplate.Master” CodeBehind=”ContentPage.aspx.vb” Inherits=”SiteTemplate.ContentPage” %>

<asp:Content ID=”Content1″ ContentPlaceHolderID=”head” runat=”server”>

</asp:Content>

<asp:Content ID=”Content2″ ContentPlaceHolderID=”ContentPlaceHolder1″ runat=”server”>

</asp:Content>

 

 

In C#

<%@ Page Title=”” Language=”C#” AutoEventWireup=”false” MasterPageFile=”~/SiteTemplate.Master” CodeBehind=”ContentPage.aspx.vb” Inherits=”SiteTemplate.ContentPage” %>

<asp:Content ID=”Content1″ ContentPlaceHolderID=”head” runat=”server”>

</asp:Content>

<asp:Content ID=”Content2″ ContentPlaceHolderID=”ContentPlaceHolder1″ runat=”server”>

</asp:Content>

 

The next picture shows this sample content page:

 

A sample content page at runtime
A sample content page at runtime