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

Binding the data from a Model..problem with the childrens

1 Answer 62 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 04 Sep 2013, 03:24 PM
Hello,
I'm currently trying to develop a menu binding the data from the datasource.... I've folowed your example at http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/menu/overview

but I'm not able to load the children
@(Html.Kendo().Menu().Name("menu").BindTo(Model, mappings =>
    {
        mappings.For<IDEA20.DO.Common.MenuItem>(binding =>
            {
                binding.ItemDataBound((item, category) => //define mapping between menu item properties and the model properties
                            {
                                item.Text = category.Text;
                                 
                            }).Children(category => category.SubMenu);
            });
 
    })
     )
My MenuItem is of type

public class MenuItem
{
    public MenuItem()
    {
        SubMenu = new List<MenuItem>();
    }
 
    public string Text { get; set; }
    public string Controller { get; set; }           
    public string Action { get; set; }
    public bool Selected { get; set; }
 
    public List<MenuItem> SubMenu { get; private set; }
}
What am I doing wrong? It only shows the first, it puts the arrow for opening but won't open...

Thanks
Paolo

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 06 Sep 2013, 11:13 AM
Hi Paolo,

I prepared a test application, which shows how to define the child menu items.
As a side note, I will suggest you continue our discussion in the support thread opened on the same matter.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Menu
Asked by
Michele
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Share this question
or