Detecting Edit Mode

Posted by Community Admin on 04-Aug-2018 16:33

Detecting Edit Mode

All Replies

Posted by Community Admin on 28-Aug-2011 00:00

How would I go about detecting, in the master page, if a page was in edit mode? And if it were in edit mode, how would I apply alternate css?  The issue I have is that an attribute I need in the css of the site to achieve the client's design is causing some issues in edit mode. I would just like to detect at the master page level if the content page is in edit mode, and if so, apply alternate css.

Thanks in advance,

BB

Posted by Community Admin on 28-Aug-2011 00:00

** Update

Ok, so I know how to detect if in edit mode, I just am not sure of how to apply alternate css.

Posted by Community Admin on 31-Aug-2011 00:00

Hello Brett,

You could use the following code snippet in the <head> section of your .master file:

<% if (InDesignMode) %>
<link rel="Stylesheet" type="text/css" href="Css/Css1.css" />
<% else %>
<link rel="Stylesheet" type="text/css" href="Css/Css2.css" />
<% %>


Kind regards,
Lubomir Velkov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 03-Sep-2011 00:00

You`ll need to do this:

using Telerik.Sitefinity.Model;
 
protected void Page_Load(object sender, EventArgs e)
    if (this.IsDesignMode())
    
    

You can also use this.IsPreviewMode() and/or this.IsBackend() accordingly to your need.

This thread is closed