Hi ,
I'm trying to construct menu that will display list of products. For each product in a collection top menu item should be created (which does work), but in each SlidePane (SubMenu item) user control should be loaded during the runtime, or instance of this control could be customized.
Code below is not displaying SlidePane, because collection is not hierarchical (correct me if I'm wrong). Do you know how this can be resolved, so I could render the content of MyUserControl for each product in the SlidePane.
VB.NET Code
Code: Visual Basic.NET
menu.DataSource = Product.GetAll()
menu.DataBind()
ASPX Page:
Code: HTML/ASPX
<eo:SlideMenu ID="menu" runat="server" DataFields="ProductName" SlidePaneHeight="200"
ExpandEmptyPane="true" >
<TopGroup >
<Items>
<eo:MenuItem >
<SubMenu >
<Items >
<eo:MenuItem CustomItemId="MyControl" ></eo:MenuItem>
</Items>
</SubMenu>
</eo:MenuItem>
</Items>
</TopGroup>
Code: HTML/ASPX
<eo : CustomItem runat="server" ID="MyControl">
<uc2:MyUserControl ID="Test" runat="server" />
</eo:CustomItem>
From my point of view that would be the ideal scenario:
Code: Visual Basic.NET
Dim menuItemForFirstProduct As New MenuItem
Dim customItem As New CustomItem()
customItem.Controls.Add(LoadControl("MyUserControl.ascx"))
testMenuItem.CustomItem = customItem
menu.Items(0).SubMenu.Items.Add(menuItemForFirstProduct)
TIA,
Max