This question is locked. New answers and comments are not allowed.
Hi All,
I'm trying to create a dynamic menu that has sub items. Basically I have one table that contains the menu and sub menu items and linked by NavigationParentId. What I'm not sure about doing is binding the child items based on the parent Id. How can I go about doing this or is there any good examples that show this?
The code I have so far is:
<%= Html.Telerik().Menu()
.Name("Menu")
.BindTo(Model.navigationAdmin.Where(i => i.NavigationParent == 0), mappings =>
{
mappings.For<BusinessObjects.NavigationAdmin>(binding => binding
.ItemDataBound((item, mainMenuItem) =>
{
item.Text = mainMenuItem.NavigationTitle;
})
.Children(NOT SURE HOW TO FIND THE CHILD ITEMS);
mappings.For<BusinessObjects.NavigationAdmin>(binding => binding
.ItemDataBound((item, subMenuItem) =>
{
item.Text = subMenuItem.NavigationTitle;
}));
})
%>
Thanks for the help
I'm trying to create a dynamic menu that has sub items. Basically I have one table that contains the menu and sub menu items and linked by NavigationParentId. What I'm not sure about doing is binding the child items based on the parent Id. How can I go about doing this or is there any good examples that show this?
The code I have so far is:
<%= Html.Telerik().Menu()
.Name("Menu")
.BindTo(Model.navigationAdmin.Where(i => i.NavigationParent == 0), mappings =>
{
mappings.For<BusinessObjects.NavigationAdmin>(binding => binding
.ItemDataBound((item, mainMenuItem) =>
{
item.Text = mainMenuItem.NavigationTitle;
})
.Children(NOT SURE HOW TO FIND THE CHILD ITEMS);
mappings.For<BusinessObjects.NavigationAdmin>(binding => binding
.ItemDataBound((item, subMenuItem) =>
{
item.Text = subMenuItem.NavigationTitle;
}));
})
%>
Thanks for the help