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

How Do I Bind TreeView To Stored Procedure Through Entity Model Framework

1 Answer 303 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 16 Oct 2019, 05:40 PM

     Hello, I have a stored procedure which has the both the parent Key/Id and Text/Name fields along with the child Key/Id and Text/Name fields. For example here are rows from sample table

Parent_Key_Id          Parent_Text_Name          Child_Key_Id          Child_Text_Name

================================================================

1                               Red                                  1                              A

1                               Red                                  2                              B

1                               Red                                  3                              C

2                               Green                               4                              D

2                               Green                               5                              E

 

and I would like the tree view to look like the following if all nodes were expanded:

Red

        A

        B

        C

Green

        D

        E

 

I've been trying to follow the demos in: 

https://docs.telerik.com/aspnet-mvc/helpers/navigation/treeview/how-to/expand-node-async

https://demos.telerik.com/aspnet-mvc/treeview/remote-data-binding

and the ExpandSelectedItemAsync solution available on your git repository, but I have not seen a good example of what I'm trying to do. I cannot bind to the tables directly because the two tables in the stored procedure are several joins away in entity model and I only want these two items. I want the child items to load only when the parent is expanded. Can someone please provide a complete and detailed example of how to accomplish this?

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 18 Oct 2019, 10:39 AM

Hello Jonathan,

If you have the controller to join the two tables and have the relation in a linear data you should be able to accomplish what you need similarly to the demo shown here: https://demos.telerik.com/aspnet-mvc/treeview/remote-data-binding

If this is not the case, can you provide a simple, locally runnable example (even with hard-coded data) to showcase the scenario so that I can properly investigate it?

Regards,
Ianko
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TreeView
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or