basic custom widget designer question
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.
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"
;
public
override
string
LayoutTemplatePath
get
if
(
string
.IsNullOrEmpty(
base
.LayoutTemplatePath))
return
HelloWorldTest.layoutTemplatePath;
return
base
.LayoutTemplatePath;
set
base
.LayoutTemplatePath = value;