Add layout control inside a widget
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!
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
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>
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.
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