Bind To MVC Hierachial Data Model

1 posts, 0 answers
  1. Or Huang
    Or Huang avatar
    4 posts
    Member since:
    Mar 2010

    Posted 22 Aug 2012 Link to this post

    Hi , 

    the data model structure the following :
    public class TreeMainItem
    {
       private IList<TreeSubItem> _SubItems;
       private bool _hasChildren =true;
     
       public TreeMainItem()
       
           _SubItems = new List<TreeSubItem>();
       }
     
       public int ItemIndex { get; set; }
       public string Title { get; set; }
       public string CssClass { get; set; }
       public string TargetUrl { get; set; }
       public string IconUrl { get; set; }
       public bool hasChildren
       {
          get { return this._hasChildren; }
          set { this._hasChildren = value; }
       }
       public IList<TreeSubItem> SubItems
       {
          get { return this._SubItems; }
          set { this._SubItems = value; }
       }
    }
     
    public class TreeSubItem
    {
       private bool _hasChildren = false;
        
       public int ItemIndex { get; set; }
       public string Title { get; set; }
       public string CssClass { get; set; }
       public string TargetUrl { get; set; }
       public string IconUrl { get; set; }
       public bool hasChildren
       {
          get { return this._hasChildren; }
          set { this._hasChildren = value; }
       }
    }

    I use Html.Kendo().TreeView().DataSource() , but treeview can't  render subitem , 

    how could I fix or use other method ?
Back to Top