Found this in the FAQ, http://world.episerver.com/FAQ/Items/Is-it-possible-to-determine-if-the-actual-page-is-in-DOPE-mode/
Seems a bit old though :)
Something messed up my post, however found this link in the FAQ: http://world.episerver.com/FAQ/Items/Is-it-possible-to-determine-if-the-actual-page-is-in-DOPE-mode/
But it seems a bit old though :)
Hmmm... First of all, the updated version:
private static bool IsDope(ControlCollection controls)
{
foreach (Control control in controls)
{
if (control.HasControls() && IsDope(control.Controls))
return true;
var prop = control as EPiServer.Web.WebControls.Property;
if (prop == null)
continue;
if (!prop.EditMode && prop.Editable)
return true;
}
return false;
}
private bool IsDope()
{
return IsDope(Page.Controls);
}
The code editor is horrible - I don't get my code to show correctly here.
But is seems that what I get here is whether the page is being edited or not... So when I use this, my script is not run in DOPE-mode (=OK) and not run in EDIT-mode (=WRONG) and not run in NOT-LOGGED-IN-MODE (=OK).
It seems weird to me that there's no simple way to check this - the controls must be rendered according to the situation...
How can i find out in CMS 5 R2 if the current page is viewed in DOPE mode or not?
I have a script that replaces some text with images - making the DOPE mode useless...
So I would like to only run this script when not in DOPE mode.
Is this possible?