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

TreeView Employees1 property

1 Answer 113 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kenp
Top achievements
Rank 1
Kenp asked on 06 Feb 2015, 12:59 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()
                            };

But what is the code inside the Employees1 property ? It should be a recursive method somehere ? Please provide the content of the model or give me more details to how make it work

Thanks for the help

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 11 Feb 2015, 10:36 AM
Hello,

I posted my reply in the other thread that you have opened with the same question. For convenience, I am pasting it below:

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