1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Detecting Edit Mode

Detecting Edit Mode

4 posts, 0 answered
  1. Brett
    Brett avatar
    36 posts
    Registered:
    23 Jul 2010
    28 Aug 2011
    Link to this post
    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
  2. Brett
    Brett avatar
    36 posts
    Registered:
    23 Jul 2010
    28 Aug 2011
    Link to this post
    ** Update

    Ok, so I know how to detect if in edit mode, I just am not sure of how to apply alternate css.
  3. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    31 Aug 2011
    Link to this post
    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 >>

  4. Saad
    Saad avatar
    98 posts
    Registered:
    10 Oct 2008
    03 Sep 2011
    Link to this post
    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.
4 posts, 0 answered