Add layout control inside a widget

Posted by Community Admin on 04-Aug-2018 18:14

Add layout control inside a widget

All Replies

Posted by Community Admin on 14-Jun-2011 00:00

Anybody got a good sample or post of how to either dynamically create or reference a layout inside of a widget. The basic idea is that I would like to have a widget for say either tabs or a collapsable widget control that would allow a designer to put content and other widgets inside the widget layout and the design view of the widget would allow them to specify certain properities such as the tabs names or style of the control.

I know how to create a widget and I know how to create a layout but mixing them together doesn't seem to have any good documentation. I've read all the docs and even submitted a ticket but I seem to me more confused them ever....

So if someone has already done this I would really appreciate some help.

Thanks!

Posted by Community Admin on 15-Jun-2011 00:00

Hello kz,

You can create tabbed LayoutControl

It would be possible to create a complex widget that has list of control which you can drag/drop and configure in the context of the designer, but you should write all UI for this implementation.

Regards,
Ivan Dimitrov
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 15-Jun-2011 00:00

Yes, I get that however i can't actually get it to work. I add a layout in my widget that seems to be there but in design view  (edit mode) I can't actually put anything into the layout. Does my layout need something like a raddock zone or  or does that automatically get created by sf?

My layout is just

<

 

 

div id="layoutWrapper" class="layoutWrapper">

 

<div id="Div1" class="sf_cols">

<div id="Div2" class="sf_colsOut sf_1cols_1_100">

<div id="Div3" class="sf_colsIn sf_1cols_1in_100">

</div>

</div>

</div>

</div>

And in my widget I loop through a list of tabnames, create a layout and add it to the .ascx panel of my widget.

 

 


foreach

 

 

(string t in TabsList)

 

Telerik.Sitefinity.Web.UI.

 

LayoutControl tabLayout;
tabLayout = new Telerik.Sitefinity.Web.UI.LayoutControl();

 

tabLayout.ID = 

 

"tLayout" + t.ToString();

 

 

tabLayout.Layout=

 

"~/MyAssemby/SitefinityControls.Widgets.Tabs.Resources.Views.aSimpleView.ascx";

 

TabPanel.FindControl(

 

"plTab" + t.ToString()).Controls.Add(tabLayout);

 

 



This all seems to work but I can't actually add any controls to the layout.

 



Posted by Community Admin on 16-Jun-2011 00:00

Hi kz,

The layout template is used only to instantiate in the placehoders. You need to add placeholders to the controls collection and then control/tabs to it. In the forum post we showed 2 ways

- server side with overriding CreateChildControls() of the LayoutControl
- the jQuery way.

Best wishes,
Ivan Dimitrov
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items

This thread is closed