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

2 posts, 0 answers
  1. Paolo
    Paolo avatar
    423 posts
    Member since:
    Jun 2009

    Posted 04 Sep 2013 Link to this post

    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

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 06 Sep 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top