Foros‎ > ‎Sharepoint‎ > ‎

SharePoint 2010 - Fix for disabled Page Layout button

publicado a la‎(s)‎ 26 jul. 2013 11:45 por Ignacio Gonzalez
Source: http://jasonssharepointblog.blogspot.com.ar/2012/03/sharepoint-2010-fix-for-disabled-page.html

The Problem


As many SharePoint users have undoubtedly discovered, sometimes there is a bug when you try to switch the page layout of a publishing page.  The bug I'm referring to is the Page Layout button being disabled.  The moderately savvy users among us have probably found the most common workaround, which is to use the 'Save and Keep Editing' option under Check-in (or any number of variations on this basic idea).  After doing this the Page Layout button becomes enabled.  So is there a better way to deal with this annoying bug?


The Cause

Let's briefly discuss the cause.  This bug appears whenever the Site Actions menu gets placed below the ribbon in the masterpage markup.  This is speculation, but it seems that the Edit Page control (found in the Site Actions menu) is used to determine if the page is in edit mode or not.  So if the ribbon is loaded before the Edit Page button (i.e. it is higher up in the page markup) then the ribbon does not enable options that should be available in edit mode.  I found this out in Chris Arella's blog here .


The Fix

The fix for this problem is very easy and doesn't require refactoring your masterpage markup.  If you simply add a second, hidden, Site Actions control at the top of the page (above the ribbon control), everything works perfectly.  So far I haven't found any side effects from doing this, it seems pretty safe.  If anyone DOES find a side effect please post it in a comment.

Here's the markup I add to the top of the page.  You'll notice that I removed all of the other Site Actions buttons and left only the Edit Page one.


<%-- hidden site actions; fixes the disabled Page Layout bug --%>
<div style="display:none;">
 <SharePoint:SiteActions
  runat="server"
  accesskey="<%$Resources:wss,tb_SiteActions_AK%>"
  id="SiteActionsMenuMainHidden"
  PrefixHtml=""
  SuffixHtml=""
  MenuNotVisibleHtml="&amp;nbsp;">
   <CustomTemplate>
     <SharePoint:FeatureMenuTemplate
      runat="server"
      FeatureScope="Site" 
      Location="Microsoft.SharePoint.StandardMenu" 
      GroupId="SiteActions" 
      UseShortId="true">
      <SharePoint:MenuItemTemplate 
       runat="server" 
       id="MenuItem_EditPage" 
       Text="<%$Resources:wss,siteactions_editpage%>" 
       Description="<%$Resources:wss,siteactions_editpagedescriptionv4%>" 
       ImageUrl="/_layouts/images/ActionsEditPage.png" 
       MenuGroupId="100" 
       Sequence="110" 
       ClientOnClickNavigateUrl="javascript:ChangeLayoutMode(false);" />
     </SharePoint:FeatureMenuTemplate>
   </CustomTemplate>
 </SharePoint:SiteActions>
</div>

Happy SharePointing!
Comments