02 Oct 2013
Link to this post
22 Feb 2014
in reply to
Thanks for throwing me a lifeline there Steve. I actually understood most of that already but began to doubt myself when nothing seemed to work. At least I know I have not just spontaneously lost my mine.
Never-the-less, I still can't get this silly thing to work. I deleted the old widget and started again from scratch ... this time the widget is called "ProductTest"
As you indicated, the CS file is wired up to the ASCX file at the end using:
#region Private members & constants
public static readonly string layoutTemplatePath = "~/Widgets/ProductTest/ProductTest.ascx";
I then hardcoded some text into the "initializecontrols" method to know for sure which path the execution was taking
protected override void InitializeControls(GenericContainer container)
Label messageLabel = this.MessageLabel;
messageLabel.Text = "Hello, World!";
// messageLabel.Text = this.Message;
messageLabel.Text = "testing testing 123";
The ASCX file has the text "Test me" so that I will know if it is simply displaying the 'view' (as you correctly descried it)
<%@ Control Language="C#" %>
<asp:Label ID="MessageLabel" Text="test me" runat="server"/>
The class grabs a reference to the control like so:
protected virtual Label MessageLabel
return this.Container.GetControl<Label>("MessageLabel", true);
Finally, the designer is be hooked in at the top of the CS file like so:
The widget itself is registered
with the "Control CLR Type or Virtual Path" set to:
When I preview the page all I ever see is "test me", the text that is found in the ASCX.
It as if the class never gets looked at ! ... This is substantiated by fact that I just get a default designer when I click "edit" on the widget when it is placed within the page.
Maybe I am not registering it correctly? I tried selecting the "Register" option when creating the widget in thunder and that was an epic fail ... when tried to add the widget to a page it would always throw an error saying that Type 'xxxx' couldn't be resolved. So I ended up doing it the way I had seen in other videos and specifying the URL path.
Anyway ... getting a little frustrated, but I am sure the solution will be simple (once I find it).
Any further thoughts?