I have the scenario below:
...... inside a RadPanelBar |
<telerik:RadPanelItem Value="SubLocations" Text="Sub Locations" Expanded="true" CssClass="subPanel"> |
<ItemTemplate> |
</ItemTemplate> |
</telerik:RadPanelItem> |
I want to fill the content of ItemTemplate with a User Control which is decided at runtime. e.g. programatically.
I have tried creating a class derived from ITemplate. e.g. MyTemplateClass. I have overriden the InstantiateIn sub and added my control
Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements System.Web.UI.ITemplate.InstantiateIn |
Dim locationsTree As SystemExplorerLocationsTree = _ |
DirectCast(m_Page.LoadControl("~/IpscObject/GUI/SystemExplorer/SystemExplorerLocationsTree.ascx"), SystemExplorerLocationsTree) |
container.Controls.Add(locationsTree) |
End Sub |
On the aspx's Page_Init handler. I set RadPanelBar.ItemTemplate to a new instance of MyTemplateClass
locationsPanel.ItemTemplate = new MyTemplateClass() |
However, the InstantiateIn function is not called. What am I doing wrong?
Thanks,
Martin