Sitefinity uses ASP.NET master pages as the basis for its page templates. Templates define the layout of pages within Sitefinity. Each page you create is assigned a
particular template. If you change the structure of a master page, all pages defined by that master page, as well as by its template, will change.
Creating a New Master Page in Visual Studio
- Launch Visual Studio 2005.
- Select App_Master, right-click and choose Add New Item.
- Select Master Page template,
- Change name to desired value.
- Click Add.

Figure 1
In order to view it in the Admin part of Sitefinity, the IIS must be reset. To do that, choose Start -> Run -> iisreset
. Then, refresh the Sitefinity application. The master page will already appear in the All Templates list of the Templates section in Sitefinity Admin (in this example,
the new master page is called Try_MasterPage.master):

Figure 2
Enter the following code in order to test the master page:
| Try_MasterPage.master |
Copy Code |
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Try_MasterPage.master.cs" Inherits="App_Master_Try_MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled
Page</title>
</head>
<body>
<form id="form1" runat="server">
<div id="header" style="clear: both; height: 60px;">
<h1>Telerik</h1>
<asp:contentplaceholder id="TopMenu" runat="server"/>
</div>
<div id="MainBody">
<asp:contentplaceholder id="UpperBody" runat="server"/>
<hr />
<asp:contentplaceholder id="LowerBody" runat="server"/>
</div>
<div id="Footer">2007 © Telerik. All rights reserved
</div>
</form>
</body>
</html>
|
 |
The content placeholder tags should either be closed by a tag "/>" or the tag
"</asp:contentplaceholder>" should be placed at the same line as the opening tag. This should be done in order to enable the
drag-and-drop operation while in page edit mode in the admin part. Otherwise, if placed on the following line, Sitefinity assumes there is already a
content in there. |
The result should be the following content of the new master page:

Figure 3
 |
Have in mind that if a master page is created in the App_Master folder, it will automatically be added and be available in
the Admin part of Sitefinity after the application is restarted. There is no need to upload that master page using the Sitefinity interface (the Admin part). If
the latter is done, a second version of the master page will be created. |
Uploading an Existing Master Page to a Sitefinity project
- Launch Visual Studio 2005.
- Select the Files folder in the project, right-click and choose Add Existing Item.
- Add the existing master page.
- Go to Sitefinity Admin, Pages tab, Templates section.
- Click Upload Master Page. (See Figure 4)
- Select the Files folder and then choose the master page you have saved.

Figure 4
 |
The file which is to be uploaded must be with extension .master. |
Using Master Pages in the Admin Part
When a page is in Edit Mode there are Select boxes in the upper part of the Admin which provides options for selection of master pages and templates. Choose from the
drop-down list the desired master page: 
Figure 5
The final result will be visible after choosing the master template. Sitefinity will create a new page based on that template. (See Figure 6) 
Figure 6
See Also