Scripts in edit mode - bug
Hello,
Could you dynamically add the document.ready to the page if the "cmspagemode" querystring doesn't exist?
Hello Lev,
Steve is right. You should suppress jQuerry execution if you are in page edit mode. One of the methods is as he describes. The other one is to only add the jQuery script reference and script block if you are not in page edit mode. In Sitefinity 4.0 if the page is being edited it will contain /Action/Edit in the URL.
Sincerely yours,
Radoslav Georgiev
the Telerik team
Hello Steve,
Just some additional information - we have added an extension method for controls which checks if you are in design mode. If you have a user control which is going to be used within Sitefinity you can check if you are in design mode using this.IsDesignMode():
public
partial
class
WebUserControl1 : System.Web.UI.UserControl
protected
void
Page_Load(
object
sender, EventArgs e)
if
(
this
.IsDesignMode())
how can i implement "isDesignMode" on a master page level?
Hi Webmaster,
You can check this forum thread which explains how to check if a page is in edit mode from the master page level.
Best wishes,
Radoslav Georgiev
the Telerik team
thanks radoslav... does that apply to sitefinity 4?
yeah, i don't think there is telerik.cms.... in sitefinity 4. what is the new path/library/property
after a lot of digging with a co-worker we found these properties to use in the master page:
Telerik.Sitefinity.Services.SystemManager.IsDesignMode Telerik.Sitefinity.Services.SystemManager.IsPreviewMode
so what's the deal here? what's the answer? how do you implement this in SF 4?
@Will
What is it you need to do? Are you trying to load scripts in the designer or find the bool page mode helpers?
bool page mode helpers... for SF 4
Theres a few like Radoslav shows
this.IsDesignMode()
this.IsBackend()
etc...
You just need to have one of these namespaces defined for those extensions methods to show up though
using
Telerik.Sitefinity.Modules.Pages.Web.UI;
using
Telerik.Sitefinity.Web.UI;
using
Telerik.Sitefinity.Web.UI.ControlDesign;
using
Telerik.Sitefinity;
using
Telerik.Sitefinity.Model;
Hi ,
IsDesignMode - static method which determines whether the control is in Sitefinity design mode - you are editing a page. There are also
IsPreviewMode- determines whether the control is in Sitefinity preview mode.
IsBackend -determines whether a control instance is in backend.
sample
protected override void OnPreRender(EventArgs e)
base.OnPreRender(e);
if(this.IsDesignMode() && !this.IsPreviewMode())
this.Controls.Clear();
Best wishes,
Ivan Dimitrov
the Telerik team