Dhanuka777
Dhanuka777

Reputation: 8616

Sitecore: Programmatically remove the Page Editor Tool bar on top

I am loading a page (item rendering e.g. /sitecore/content/.../Page) inside an IFrame. It shows the Page Editor ribbon as well. I want to hide that tool bar, it is not required in my scenario.

But if I set the source URL for IFrame like http://mysite/somefolder/page.aspx it does not display the Page Editor controls.

That means Page Editor controls gets loaded on demand. Need to know how to stop loading Page Editor controls on the page. Please let me know if you know how to stop those controls being loaded to the page.

Upvotes: 2

Views: 1450

Answers (2)

Dhanuka777
Dhanuka777

Reputation: 8616

I found a solution, I am hiding this ribbon with CSS, it's a very simple solution,

<style>
    /*Hide the edit mode ribbon panel appears in the iframes. Originally added this to Price strategy control.*/
    #scWebEditRibbon, #scCrossPiece
    {
        display: none;
    }
</style>

Upvotes: 1

jammykam
jammykam

Reputation: 16990

This is because the page is in Edit mode. Will this page never need to loaded in the page editor? If not then you can add the following to the Page_Load event:

Sitecore.Context.Site.SetDisplayMode(Sitecore.Sites.DisplayMode.Normal, Sitecore.Sites.DisplayModeDuration.ResetAfterRequest);

Otherwise you can append ?sc_mode=normal to the URL when setting the src of the iFrame to achieve the same thing. This way if you want to edit the page outside the iFrame you can use the standard Sitecore Page Editor features.

What were/are you setting the URL of the IFrame to currently (when you get the controls)?

Upvotes: 3

Related Questions