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

Forums / Sitefinity SDK / How to know that we are in edit mode

How to know that we are in edit mode

5 posts, 1 answered
  1. Paulo
    Paulo avatar
    19 posts
    Registered:
    03 Nov 2010
    29 Nov 2010
    Link to this post
    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
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    29 Nov 2010
    Link to this post
    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.
  3. Paulo
    Paulo avatar
    19 posts
    Registered:
    03 Nov 2010
    29 Nov 2010
    Link to this post
    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.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    29 Nov 2010
    Link to this post
    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.
    Answered
  5. Paulo
    Paulo avatar
    19 posts
    Registered:
    03 Nov 2010
    29 Nov 2010
    Link to this post
    Thank you,

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

5 posts, 1 answered