More in this section
Blogs RSS feed

Making Your Sitefinity Widget Templates Editable through the UI - Part 2

by Stanislav Velikov
This blog post is an extension to the blog post from Slavo Ingilizov for making widget templates editable trough the UI.

This blog post will address how to make the custom widget template persist in the UI after it has been edited (not removed after a single edit to the template) and how to create a custom resource class which will create new area name for the widget so that it can be placed in different areas from the preexisting areas of the built-in widgets.

1. Registering the widget template and making it persist in the UI.

To make the widget template persist in the class for the widget, add a new attribute ControlTemplateInfo:

[ControlTemplateInfo("CustomControlResources", "FriendlyName", "WidgetArea")]
    public class NewWidget : SimpleView
//rest of the widget implementation is below

ControlTemplateInfo makes the widget template for this widget registered to a specific Area, and it accepts three parameters:

"CustomControlResources" - This is the resource name, I will describe how to create custom resource below.

"FriendlyName" - this is the name of the section toward which this template belongs, in case a single widget has multiple templates registered for it.

"WidgetArea" - this is the Area in which the widget is registered (see screenshot below).

2. Add a custom resource class creating the resource entries used in the above registration.

2.1 Create a class that inherits Sitefinity.Localization.Resource. The class used for the above resources is provided below:

using Telerik.Sitefinity.Localization;
using Telerik.Sitefinity.Localization.Data;
namespace SitefinityWebApp
    [ObjectInfo("CustomControlResources", ResourceClassId = "CustomControlResources")]
    public class CustomControlResources : Resource
        public CustomControlResources()
        public CustomControlResources(ResourceDataProvider dataProvider)
            : base(dataProvider)
                       Value = "WidgetArea",
                       Description = "The title of this class.",
                       LastModified = "2009/05/13")]
        public string BlogResourcesTitle
                return this["WidgetArea"];
            Value = "Friendtly name of the control",
            Description = "description",
            LastModified = "2010/11/11")]
        public string BlogsMasterViewFriendlyName
                return this["FriendlyName"];

2.2. To register and use the custom resource class in Global.asax, register the class by subscribing to Bootsrapper.Initialized in Application_Start event:

protected void Application_Start(object sender, EventArgs e)
           Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(this.AfterInit);
       private void AfterInit(object sender, ExecutedEventArgs args)
The registered custom resource class can further be extended with additional resource entries from the Administration-> Interface Labels and Messages module.

3. Registering the widget template for the control using the resource class entries

The widget template registration can be altered to include the resource classes for which the widget has been registered.

var initializer = SiteInitializer.GetInitializer();


Leave a comment
  1. joe Dec 07, 2013
    An actual working sample that we could download would be extremely helpful.
  2. Yitro Feb 02, 2014
    Hi Stanislav ,

    Very useful post. I'm wondering how about if I'm using MVC widget, how could I register my MVC widget as a widget for custom module built by Module Builder and also make those views (master and detail) editable through the UI? Thanks
  3. Vinanthi Sep 22, 2016

    Hi Stanislav,

    As Yitro told it is very useful post. Even I have the same concern as Yitro, it would be great if you help us.

    Leave a comment