Grid with a hierarchical foreingkey

4 posts, 0 answers
  1. Kevin
    Kevin avatar
    2 posts
    Member since:
    Jul 2015

    Posted 25 Aug 2015 Link to this post

    Hi,

           I have 2 tables

                 Table1 : ID,Table2ID

                  Table2 : ID, Description

    Table1 as a 1 to many relationship with Table2

    Table2 as a 0..1 to many relationship with Table2

    I would like to show Table1 in a grid and have a treeview to display the Table2 during Create and Update.

    Can someone help me to achieve this?

     

    regards

  2. eo
    eo avatar
    27 posts
    Member since:
    Jul 2015

    Posted 25 Aug 2015 in reply to Kevin Link to this post

    Hello Kevin,

    I wouldn't recommend trying to put treeviews inside of a grid because that is not its intended use. It sounds like using a hierarchical grid is the way to go in your case. Here's a Telerik demo that shows this functionality for ASP.NET MVC.

    Hope that helps!

  3. Kevin
    Kevin avatar
    2 posts
    Member since:
    Jul 2015

    Posted 26 Aug 2015 in reply to eo Link to this post

    Hi eo,

     

        I am not sure this will fix my issue that I need to show during edition or creation of a new Table1 record the hierarchy of Table2.

        To give a more practical touch to this post here the class and database.

    Table 1 : BypassEquipmentLog

     

    public class BypassEquipmentLog
    {
        [ScaffoldColumn(false)]
        public int Id { get; set; }
     
        //[UIHint("ApproverEditor")]
        public Approver Approver { get; set; }
     
        //[UIHint("ManagerEditor")]
        public Manager Manager { get; set; }
     
        //[UIHint("WorkerEditor")]
        public Worker Worker { get; set; }
     
        public Asset Asset { get; set; }
     
        public string Description { get; set; }
     
        public string Reason { get; set; }
     
        public DateTime Date { get; set; }
     
        public DateTime Timestamp { get; set; }
    }

    Table2 : Asset

    public class Asset
        {
            public long Id { get; set; }
            public string Description { get; set; }
            public bool HasChildren { get; set; }
        }

    Database see attach.

     

  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2035 posts

    Posted 27 Aug 2015 Link to this post

    Hello Kevin,

     

    Please find an Grid Popup Editing Navigation Property Collection with nested Grid project that demonstrates a how to edit a nested collection with another Grid and perform single request to update both the parent and the child grids with a single request.

     

    Regards,
    Boyan Dimitrov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top