add class only in CMS view


Is there any way to add a class to an element only when the site is viewed in the CMS? I want to hide certain elements on the end user site, but show the content in the CMS so clients can easily edit it.


Jul 24, 2015 23:27

You can check in controller action / view if the page is opened in edit mode like this:

if (EPiServer.Editor.PageEditing.PageIsInEditMode)

Hope this helps

Edited, Jul 25, 2015 0:53


Jul 27, 2015 21:44
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.