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;
</script>

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" />

4.)<SharePoint:SPRibbon
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()    {
       SP.Ribbon.HelpPageComponent.registerWithPageManager();   
}   
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>


<SharePoint:PopoutMenu
Container for popup menus used throughout Sharepoint 2010.


<SharePoint:ListSiteMapPath

Display breadcrumbs within site, subsites, and libraries.

<SharePoint:SPRibbonPeripheralContent
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

<Sharepoint:DeveloperDashboardLauncher
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;
    cs.DeveloperDashboardSettings.Update();
 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.


References:

This article outlines exactly which placeholder and classes to be aware of when upgrading an Existing Master Page to the SharePoint Foundation Master Page
http://msdn.microsoft.com/en-us/library/ee539981.aspx

NightAndDay.Master
http://msdn.microsoft.com/en-us/library/ff625186.aspx

Customizing Ribbon positioning
http://www.facebook.com/notes/microsoft-sharepoint-server-2010/customizing-ribbon-positioning-in-sharepoint-2010-master-pages/440358734744

Ribbon Customization: Changing Placement, Look and Behavior
http://styledpoint.com/blog/ribbon-customization-changing-placement-look-and-behavior/

SharePoint 2010 – Enable & using Developer Dashboard
http://blogs.technet.com/b/patrick_heyde/archive/2009/11/16/sharepoint-2010-enable-using-developer-dashboard.aspx

 

Working with SharePoint 2010 Foundation Master Pages
http://blog.allyis.com/blog/bid/48102/Working-with-SharePoint-2010-Foundation-Master-Pages

TechNet
http://social.technet.microsoft.com/Forums/en-US/category/sharepoint2010