Try Now
More in this section

Forums / Developing with Sitefinity / Get widget designer param from within Widget code behind

Get widget designer param from within Widget code behind

2 posts, 0 answered
  1. Cody
    Cody avatar
    1 posts
    24 Jul 2014
    11 Sep 2014
    Link to this post

    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 ?



  2. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    18 Feb 2004
    16 Sep 2014 in reply to Cody
    Link to this post

    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,

2 posts, 0 answered