More in this section

Forums / Developing with Sitefinity / How to tell if in admin mode

How to tell if in admin mode

2 posts, 0 answered
  1. Chris Wilper
    Chris Wilper avatar
    13 posts
    Registered:
    01 Sep 2009
    20 Nov 2009
    Link to this post
    I've created a custom page template that I have code in the pageload event.  How can I check to see if I'm in admin mode so I can ignore the code when a user tries to edit the template.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    20 Nov 2009
    Link to this post
    Hello Chris Wilper,

    Thank you for using our services.

    You can either check if the url contains cmspagemode=edit in the query string or check if the page is live like this:
    Telerik.Cms.Web.CmsPageBase page = this.Page as Telerik.Cms.Web.CmsPageBase;
    if (page.PageMode == Telerik.Cms.Web.CmsPageMode.Live)
    {
              //
    }

    This can be used in the page load event. I would recommend this approach.

    Best wishes,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered