How to hide the SharePoint Ribbon in Non-Edit Mode

If you’ve ever developed a page for SharePoint 2007 you certainly used the EditModePanel control to control content visibility. This control now has changed in SP 2010 and ignores the Page Editmode. But there is a possibility to do this with no custom code.


  1.  Locate the position of the class "s4-ribbonrow" and add a display style. (Or overwrite the class in your css). This will hide the panel in DisplayMode.
    <div class="s4-pr s4-ribbonrowhidetitle" id="s4-ribbonrow" style="display: none;">

  2. Add following code after the ribbon div. This will show the ribbon in EditMode.
    <publishingwebcontrols:authoringcontainer displayaudience="AuthorsOnly" runat="server"><publishingwebcontrols:editmodepanel pagedisplaymode="Edit" runat="server"><script type="text/javascript">  document.getElementById("s4-ribbonrow").style.display = "block";</script></publishingwebcontrols:editmodepanel></publishingwebcontrols:authoringcontainer>


Publishing WebControls must be the namespace "Microsoft.SharePoint.Publishing.WebControls".


Further Links

Comments

Popular posts from this blog

Open SharePoint 2010/2013 Display, Edit, New Forms in Modal Dialogs

Ways to redirect http requests in SharePoint

Using WebDav on IIS 7 to access UNC Paths