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

Forums / Thunder / basic custom widget designer question

basic custom widget designer question

2 posts, 0 answered
  1. Sheldon
    Sheldon avatar
    11 posts
    Registered:
    02 Oct 2013
    21 Feb 2014
    Link to this post
    Very new to Sitefinity so I am sure this will be a easy one (not for me).

    I used Thunder to create the default "Hello World" custom widget and designer ... just so I could play with it.   I called it "HelloWorldTest"

    The strange thing is, when I look at the code that is generated I see a basic  HelloWorldTest.ascx but without any code behind.    

    <%@ Control Language="C#" %>
    <asp:Label ID="MessageLabel" Text="Text" runat="server"/>

    There is also the designer and a HellowWorldTest.cs file, but I see no way in which these files are linked. 

    As expected, when I registered this widget in tools and placed it on a page it just displays "Text", and when it click "Edit" it gives me the standard designer without the "Message" property.

    Am I supposed to add some code behind to the ASCX file to bootstrap the registering of the custom property and designer?

    I have a feeling I am missing the obvious here, but have been struggling for a while.

    Any hints would be greatly appreciated.
  2. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    24 Feb 2014
    Link to this post
    Hello Sheldon,

    You have created a user control. More information about user control, you can find in Sitefinity documentation:
    http://www.sitefinity.com/documentation/documentationarticles/developers-guide/how-to/how-to-create-a-coverflow-control/creating-an-empty-silverlight-based-control/creating-a-custom-control

    If you look in your HelloWorldTest.cs file, you will find a field referencing the layout template path:
    public static readonly string layoutTemplatePath = "~/HelloWorldTest.ascx";

    which is used in LayoutTemplatePath property:
    public override string LayoutTemplatePath
    {
        get
        {
            if (string.IsNullOrEmpty(base.LayoutTemplatePath))
                return HelloWorldTest.layoutTemplatePath;
            return base.LayoutTemplatePath;
        }
        set
        {
            base.LayoutTemplatePath = value;
        }
    }

    You can also consider watch this nice video tutorial made by Gabe Sumners for User Controls and Control Designers in Sitefinity:
    http://www.youtube.com/watch?v=Go7GiYIyPxg

    I hope this helps.

    Regards,
    Vassil Vassilev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered