Controls inheriting from SimpleView have a property IsBackend. If it's true, e.g. in InitializeControls, you could not execute whatever is taking place there. There are other properties as well, like IsDesignMode, that may offer what you need.
My controls is a UserControl with code-behind. Is there any documentation on changing this to inherit from SimpleView?
Is there anyway to prevent my ascx control from rendering when in edit mode in the backend? At present it is preventing me from accessing the edit controls of Sitefinity as the CSS is placing some divs over the controls
The main difference between custom and user widgets is that custom widgets must inherit the SimpleView class. That makes the registration of custom widgets different, that is, you must provide the complete path when registering a new custom widget in Sitefinity Toolbox. In contrast, you register user widgets by virtual path. In addition, to map the markup file of a custom widget with its code-behind, you must override the LayoutTemplatePath property and put the complete path of the markup instead. For more information, see:
IsDesignMode - 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. Please refer to the sample code below:
.IsDesignMode() && !
WebUserControl2 : System.Web.UI.UserControl
sender, EventArgs e)
//hide it here
Hi Stefani Tacheva,
How can I implement the same functionality in my Mvc widget?
I don’t want do display the fields in design mode.
Hi. In Mvc widgets you can use conditions for determine backend and preview mode like that
//if it is not backend
//if it is not preview mode