Asp Net TreeView

2 posts, 0 answers
  1. Kenp
    Kenp avatar
    2 posts
    Member since:
    Feb 2015

    Posted 05 Feb 2015 Link to this post


    I'm new to  kendo and i was trying to display a treeView using the ASP MVC approach so i followed the exemple you provided :

    var employees = from e in db.Employees
                                where (id.HasValue ? e.ReportsTo == id : e.ReportsTo == null)
                                select new
                                    id =,
                                    Name = e.FirstName + " " + e.LastName,
                                    hasChildren = e.Employees1.Any()

    My question is:  where the Employees1 comes from ? (I guess from the model) but what is the code inside this function ? where's the recursive function to loop on each child ? Can you provide the model and see what is inside ? 

  2. Daniel
    Daniel avatar
    2231 posts

    Posted 10 Feb 2015 Link to this post


    Employees1 is a navigational property created by EF which can be used to get the related employees. No recursive function is needed in this scenario. The particular demo loads the children on demand and makes a separate request for each node children so the result from the server should be just the children of the item with id equal to the id value passed with the request. You can check the model and all related code in the sample application included with the wrappers.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top