How to know that we are in edit mode

Posted by Community Admin on 05-Aug-2018 09:54

How to know that we are in edit mode

All Replies

Posted by Community Admin on 29-Nov-2010 00:00

Hi

I whant to show diferent contents in my widget dependig if it is at editing mode or not.
I found a way by finding "Action/Edit" in the RawUrl of the request, but i don't think that's the correct way to do-it  and

this.DesignMode // always return false

I'am using the last version of sitefinity released 26 November.


Thanks in advance

Posted by Community Admin on 29-Nov-2010 00:00

Hi Paulo,

Try using IsDesignMode. This is a control extension.

IsDesignMode is extension 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.


Sincerely yours,
Ivan Dimitrov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Posted by Community Admin on 29-Nov-2010 00:00

Hi,

I forgot to say that i am in a  SimpleView derived class and I cannot find those properties.
I had searched, but didn't found any property related.

thanks.

Posted by Community Admin on 29-Nov-2010 00:00

Hi Paulo,

You can use these extensions in a custom widget. Most probably you do not have some reference added to the class you have created

sample

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.Sitefinity.Web.UI;
 
using System.Web.UI;
 
 
 
namespace Telerik.Sitefinity.Samples
    public class SimpleViewCustom : SimpleView
    
        protected override void InitializeControls(GenericContainer container)
        
            if (this.IsDesignMode())
            
 
            
        
 
        protected override string LayoutTemplateName
        
           
        
    


Best wishes,
Ivan Dimitrov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Posted by Community Admin on 29-Nov-2010 00:00

Thank you,

I am used to clean the unused references... thats why i dind have the extensions.

This thread is closed