A Master Page acts as a template for Content Pages and
Content Pages provide content to populate the Master Pages. A Master Page is
essentially a standard ASP.NET page except that it uses the extension of
.master and a <%@ master %> directive instead of <%@ page %>.
Reference: Master
Your Site Design with Visual Inheritance and Page Templates.
Create a Master Page
To add a Master Page to your web solution you need to right
click on you web solution, choose Add New Item and select Master Page.
Figure 6
Once you have completed this step you will see the ASPX
source similar to the following.
Listing 9
<form id="form1" runat="server">
<div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
The content Place Holder is where other pages that inherit
the Master Page will place its content. At this point if you wish to have a
header, footer and navigation area you should now add this to your Master Page.
Here is an example.
Figure 7
As you can see in the above figure, the Master Page has five
areas of which the content page is an ASPX that I have placed within the
contentplaceholder. This allows me to maintain a consistent look and feel of
the UI for my users. Also, I do not have to repeat the design layout as the
site grows.
One thing I should mention is that you may have multiple
master pages and use each one for a different purpose or simply design layout. For
example, if you are using authentication, you want to provide a guest master
page and a member master page. By following this theory you can control what
each group may see and do.