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.
Publishing WebControls must be the namespace "Microsoft.SharePoint.Publishing.WebControls".
Further Links
- 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;">
- 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