How to know that we are in edit mode - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

How to know that we are in edit mode

  • How to know that we are in edit mode
  • 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
  • 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.
  • 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.
  • 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.
  • Thank you,

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