This is a migrated thread and some comments may be shown as answers.

[Solved] Menu subItem by ParentId

0 Answers 21 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
craig
Top achievements
Rank 1
craig asked on 27 May 2011, 11:50 AM
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
Tags
Menu
Asked by
craig
Top achievements
Rank 1
Share this question
or