3. Types of Master Pages
1- Application Master Pages
Deals with your custom Site Look and Feel
2- System Master Pages
Deal with SharePoint System Pages
Commonly used Master Pages
v4.master
- (New Blue Ribbon Bar, SharePoint 2010 Master Page)
default.master
- Sites upgraded from SharePoint 2007 use this unless they are changed to use a v4 version)
minimal.master
- Master page contains almost nothing. It is used by the Search Center and Office Web
Applications. commonly referred to as Starter Master Pages in SharePoint 2010.
4. Mandatory Placeholders
Placeholder Control Description New
PlaceHolderQuickLaunchTop The top of the Quick Launch menu.
PlaceHolderQuickLaunchBottom The bottom of the Quick Launch menu.
PlaceHolderPageTitle The title of the site.
PlaceHolderAdditionalPageHead A placeholder in the head section of the
page used to add extra components such as
ECMAScript (JavaScript, JScript) and
Cascading Style Sheets (CSS) to the page.
PlaceHolderBodyAreaClass The class of the body area.
SPNavigation A control used for additional page editing
controls.
PlaceHolderSiteName The name of the site where the current
page resides.
5. Mandatory Placeholders
Placeholder Control Description New
PlaceHolderPageTitleInTitleArea The title of the page, which appears in
the title area on the page.
PlaceHolderPageDescription The description of the current page.
PlaceHolderSearchArea The section of the page for the search
controls.
PlaceHolderGlobalNavigation The breadcrumb control on the page.
PlaceHolderTitleBreadcrumb The breadcrumb text for the breadcrumb
control.
PlaceHolderGlobalNavigationSite The list of subsites and sibling sites in the
Map global navigation on the page.
PlaceHolderTopNavBar The container used to hold the top
navigation bar.
6. Mandatory Placeholders
Placeholder Control Description New
PlaceHolderHorizontalNav The navigation menu that is inside the
top navigation bar.
PlaceHolderLeftNavBarDataSource The placement of the data source used
to populate the left navigation bar.
PlaceHolderCalendarNavigator The date picker used when a calendar is
visible on the page.
PlaceHolderLeftNavBarTop The top section of the left navigation bar.
PlaceHolderLeftNavBar The Quick Launch bar.
PlaceHolderLeftActions The additional objects above the Quick
Launch bar.
PlaceHolderMain The main content of the page.
7. Mandatory Placeholders
Placeholder Control Description New
PlaceHolderFormDigest The container where the page form
digest control is stored.
PlaceHolderUtilityContent The additional content at the bottom of
the page. This is outside of the form tag.
PlaceHolderTitleAreaClass The class for the title area. This is now in
the head tag. Any customizations that
add a WebPartZone in a content tag to
this placeholder will cause an error on
the page.
8. Mandatory Placeholders (backward compatibility)
Placeholder Control Description New
PlaceHolderPageImage This placeholder does not appear as part
of the UI and must be present for
backward compatibility.
PlaceHolderTitleLeftBorder This placeholder does not appear as part
of the UI and must be present for
backward compatibility.
PlaceHolderMiniConsole This placeholder does not appear as part
of the UI and must be present for
backward compatibility.
PlaceHolderTitleRightMargin This placeholder does not appear as part
of the UI and must be present for
backward compatibility.
9. Mandatory Placeholders (backward compatibility)
Placeholder Control Description New
PlaceHolderTitleAreaSeparator This placeholder does not appear as part
of the UI and must be present for
backward compatibility.
PlaceHolderNavSpacer This placeholder does not appear as part
of the UI and must be present for
backward compatibility.
PlaceHolderLeftNavBarBorder This placeholder does not appear as part
of the UI and must be present for
backward compatibility.
PlaceHolderBodyLeftBorder This placeholder does not appear as part
of the UI and must be present for
backward compatibility.
10. Mandatory Placeholders (backward compatibility)
Placeholder Control Description New
PlaceHolderBodyRightMargin This placeholder does not appear as part
of the UI and must be present for
backward compatibility.
11. Master Page in Code Behind Case
<%@ Assembly Name=“DLL Name, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=35ea4244489a016b" %>
<%@ Master language="C#"
Inherits=“CompleteNamespace.CodeBehind.MasterPages.CorporateMasterClass" %>
12. Master Page For Dialog Pages
class="s4-notdlg"
--------------------------------------
It goes in every div that you don't want to show in a dialog box.
Example: Common places would be the logo, navigation, and footer.
13. Master Page for Dialog Pages
How to Hide Top Bar, Ribbon, Quick Launch in SharePoint 2010
------------------------------------------------------------------------------------------------------------------
<style type="text/css">
#s4-ribbonrow, .ms-cui-topBar2, .s4-notdlg, .s4-pr s4-ribbonrowhidetitle, .s4-notdlg
noindex, #ms-cui-ribbonTopBars, #s4-titlerow, #s4-pr s4-notdlg s4-titlerowhidetitle, #s4-
leftpanel-content {display:none !important;}
.s4-ca{margin-left:0px !important; margin-right:0px !important;}
</style>
14. Master Page CSS
Specifying CSS files
------------------------------------------------------------------------------------------------------------------
<link href="/Style Library/IntranetCSS/Corporate-Master.css" rel="stylesheet"
type="text/css" />
<Sharepoint:CssRegistration name = "<% $SPUrl:~SiteCollection/Style
Library/AteaIntranetCSS/MyCustomCssFile.css %>" runat="server" after="corev4.css"
></Sharepoint:CssRegistration>
• after=“corev4.css” load this custom css file after this specified css file “corev4.css”
• $SPUrl:~SiteCollection Path started from Site Collection (Top Level Site)
”~SiteCollection” referes to the root site of the site collection.
”~Site” refers to the context of the current site which may be a sub-site also.
15. Master Page Javascript
Specifying Script files
------------------------------------------------------------------------------------------------------------------
Normal Way
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
Automatically generate Script tag
<asp:ScriptReference Path="<%$SPUrl:~SiteCollection/Style Library/scripts/jquery-
1.5.min.js%>"></asp:ScriptReference>
16. Master Page User Control
Specifying User Controls in Master Page
------------------------------------------------------------------------------------------------------------------
<%@ Register src = "~/_controltemplates/MyIntranet.Controls.UC/ucTopNav.ascx"
tagname="ucTopNav" tagprefix="uc1" %>
17. Master Page Web Control
Specifying Web Controls in Master Page
------------------------------------------------------------------------------------------------------------------
<%@ Register TagPrefix=“MyInranet" Namespace=“MyIntranet.Controls.WebControls"
Assembly=“MyIntranet.Controls, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=381ced654b713b32" %>
18. Master Page Delegate Controls
Delegate Controls
------------------------------------------------------------------------------------------------------------------
A delegate control defines a region in an “.aspx” page that allows the content to be
replaced with our custom content. This custom content is created via a SharePoint
feature, and when deployed and activated, replaces the standard content at runtime
Example: <SharePoint:DelegateControl runat=”server” ControlId=”GlobalNavigation”/>
ControlId value determines what delegate control.
Global Navigation bar has a ControlId value of GlobalNavigation
20. Master Page Delegate Controls
<Control Id = “GlobalNavigation” Sequence=”90”
ControlSrc=”~/_ControlTemplates/ucGlobNavDelegateControl.ascx” />
Sequence should be less than 100.
The ControlSrc value indicates the location to our custom delegate control.