Get widget designer param from within Widget code behind

Posted by Community Admin on 04-Aug-2018 19:53

Get widget designer param from within Widget code behind

All Replies

Posted by Community Admin on 11-Sep-2014 00:00

I have a widget i'm building based on a dynamic component from the module builder.

I used Sitefinity Thunder to build the widget with designer. I've added params to the designer. One of the params is "columns per row".

 In my widget I use a repeater to build a table/grid of boxes, one box (div) representing each item in the list.

In my .ascx or the .ascx.cs code behind, how do I get the value of the parameter that was set from the designer? I need to use it in to customize my repeater data bind to run some custom code every Nth.

 I know I can set values on components from my widget using this: 

return this.Container.GetControl<Label>("MessageLabel", true);

But instead of "getting a control", how can I get/set a variable inside my widget .ascx.cs ?

Thanks.

 

Posted by Community Admin on 16-Sep-2014 00:00

Hi Cody,

Normally you would define some custom properties inside the code-behind file of your UserControl, which is the widget.

Then, using Thunder, you could expose those custom properties to the designer that Thunder is about to create.

I'm not sure how you started this widget and how you created the properties in your designer? If you did it like I described, you should be able to just use the custom properties within your code-behind.

Best regards,
Daniel

This thread is closed