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

Asp Net TreeView

1 Answer 35 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kenp
Top achievements
Rank 1
Kenp asked on 05 Feb 2015, 04:34 PM
Hi,

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 = e.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 ? 

Thanks

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 10 Feb 2015, 10:29 AM
Hi,

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.

Regards,
Daniel
Telerik
 

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.

 
Tags
TreeView
Asked by
Kenp
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or