Check if user control in edit mode

Posted on: Wed Jun 03 11:05:57 -0700 2009. Updated on: Wed Jun 03 11:09:23 -0700 2009.
Category: Telerik Controls and Sitefinity

In Sitefinity, we sometimes want to be able to know if a custom user control we have built is in edit mode, ie when you are in the designer. This can be useful to not execute javascript or not draw certain things that would mess up the usability / cause errors in the designer. It is quite easy, we are basically checking for the querystring cmspagemode.

string mode = Request.Querystring.Get("cmspagemode");

if(mode != null)
{
    // running in SF preview mode
    if(mode == "edit")
    {
        // running in edit mode
    }
}

Comments:

Thu Mar 11 03:56:06 -0800 2010
fg


---------------------------------------------------

Thu Mar 11 03:56:26 -0800 2010
Bakwas


---------------------------------------------------

Add a Comment:

simple_captcha.jpg
(human authentication)


Ads

Categories

About

Random foliage

This website is meant to be a reference for ASP Dot Net developers. The entries are a compilation of things I've figured out how to do and that I deem useful to keep of track for future reference. Assumptions: web development with: C Sharp (vb sucks), visual studio 05/08, .net 3.5, meant for programmers. Written by: James Reategui.