Thursday, August 5, 2010

Server Tags within Sharepoint 2010 v4.master

Steve Samnadda, Director, Technology

Just got done creating my first Masterpage for Sharepoint 2010 and I thought I would outline some of the new server tags I discovered in v4.master.  V4.master refers to "Version 4 UI" and is the default 2010 master which includes all the new bells and whistles including the Ribbon.

If you are looking to maintain the look and feel of a 2007 masterpage default.master is also included within each team site.  This supports the standard 2007 look and feel known as the "Version 3" User Interface.

Starting with the <head> tag you will notice the following javascript variable.  This tag is needed to kickoff the Sharepoint Ribbon in the version 4 UI. 

<script type="text/javascript">
    var _fV4UI = true;

There are four Server Controls necessary to render the Ribbon:

These two tags go inside <head> tag

1. <SharePoint:SPPageManager runat="server"/>

2. <SharePoint:ScriptLink language="javascript" name="core.js" OnDemand="true" runat="server"/>

ScriptManager is placed immediately after the <Form> tag

3. <asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" />

Places the Ribbon control on the page.  For more info on the div tags required for the Ribbon placement see links at the bottom of this page.

<SharePoint:ULSClientConfig runat="server"/>
This control would output the relevant script that enables error reporting.

<SharePoint:SPShortcutIcon runat="server" IconUrl="/_layouts/images/favicon.ico"/>

Simple tag to output a shortcut icon for your site.  The default looks like this:

<SharePoint:SPHelpPageComponent Visible="false" runat="server"/>
Adds the following script to the page:

function _registerHelpComponent()    {
ExecuteOrDelayUntilScriptLoaded(_registerHelpComponent, \"sp.ribbon.js\");

<SharePoint:SPNoScript runat="server"/>

adds the following tag to the page, used in the event javscript is turned off
<div class="noindex">You may be trying to access this site from a secured browser on the server. Please enable scripts and reload this page.</div>

Container for popup menus used throughout Sharepoint 2010.


Display breadcrumbs within site, subsites, and libraries.

Exposes design controls, tagging controls, view state controls, and related design and behaviorial controls for the ribbon user interface. You can use the Location() method to update where the content appears on the page.

<SharePoint:PageStateActionButton id="PageStateActionButton" runat="server" Visible="false" />

Actually.... not really sure what this do-hickey does

<SharePoint:DeveloperDashboard runat="server" />
The developer dashboard displays information relevant to each page load, including:

   1.  What controls loaded and how long each took to load
   2. Specific database queries executed and the execution time of each
   3. Events that were fired during the page load
   4. Order of the page lifecycle and time during each stage

<div id="DeveloperDashboard" class="ms-developerdashboard" />
Actual location of dashboard

Displays an icon to launch the developer dashboard if active.  You can activate the developer dashboard either through stsadm or code.

 1. stsadm:  STSADM –o setproperty –pn developer-dashboard –pv OnDemand
 2. code:
    SPWebService cs = SPWebService.ContentService;
    cs.DeveloperDashboardSettings.DisplayLevel = SPDeveloperDashboardLevel.On;
 3. If you enable the dashboard but remove the Launcher Icon you can still launch it by appending the querystring: "?DeveloperDashboard=true"

<SharePoint:UIVersionedContent UIVersion="3" runat="server">
Indicates UI version of encapsulated content.  Content that does not match the UI version is not rendered.


This article outlines exactly which placeholder and classes to be aware of when upgrading an Existing Master Page to the SharePoint Foundation Master Page


Customizing Ribbon positioning

Ribbon Customization: Changing Placement, Look and Behavior

SharePoint 2010 – Enable & using Developer Dashboard


Working with SharePoint 2010 Foundation Master Pages