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

2 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    3 posts
    Member since:
    Mar 2019

    Posted 16 Oct Link to this post

         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?

  2. Ianko
    Admin
    Ianko avatar
    1898 posts

    Posted 18 Oct Link to this post

    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.
Back to Top