How do I create a hierarchary on a column instead of a data row in a GridView

8 posts, 1 answers
  1. Jay
    Jay avatar
    11 posts
    Member since:
    Mar 2019

    Posted 19 Aug 2019 Link to this post

    The data source for my main GridView object is a list of a custom object, which in turn contains child objects, and I want to be able to create a hierarchy grid that allows the user to drill into these child objects. I understand how to create the hierarchy if the entire row is a child record, but not how to accomplish this when a cell is the child record.

    Example of my custom object is below.
    public class Claim
    {
        public Claim();
     
        //
        // Summary:
        //     Provider billing for services
        public Provider BillingProvider { get; set; }
        //
        // Summary:
        //     Claimant
        public Claimant Claimant { get; set; }
        //
        // Summary:
        //     Claim number
        public string ClaimNumber { get; set; }
        //
        // Summary:
        //     Member
        public Member Member { get; set; }
        //
        // Summary:
        //     Policy
        public Policy Policy { get; set; }
        //
        // Summary:
        //     Process date
        public DateTime ProcessDate { get; set; }
        //
        // Summary:
        //     Date claim was received
        public DateTime ReceiveDate { get; set; }
        //
        // Summary:
        //     Provider rendering services
        public Provider RenderingProvider { get; set; }
        //
        // Summary:
        //     List of services provided
        public List<Service> ServiceList { get; set; }
        //
        // Summary:
        //     Address where services were provided
        public Address ServiceLocation { get; set; }
        //
        // Summary:
        //     Worksheet / bill number
        public int Worksheet { get; set; }
    }
    //
    // Summary:
    //     Member
    public class Member : Person
    {
        public Member();
     
        //
        // Summary:
        //     Effective date
        public DateTime EffectiveDate { get; set; }
        //
        // Summary:
        //     Member ID
        public string MemberId { get; set; }
        //
        // Summary:
        //     Member's coverage policy
        public Policy Policy { get; set; }
        //
        // Summary:
        //     Termination date
        public DateTime TerminationDate { get; set; }
    }
    //
    // Summary:
    //     Person
    public class Person
    {
        public Person();
     
        //
        // Summary:
        //     Contact address
        public Address Address { get; set; }
        //
        // Summary:
        //     Date of birth
        public DateTime Dob { get; set; }
        //
        // Summary:
        //     First name
        public string FirstName { get; set; }
        //
        // Summary:
        //     Gender
        public string Gender { get; set; }
        //
        // Summary:
        //     Last name
        public string LastName { get; set; }
        //
        // Summary:
        //     Middle name
        public string MiddleName { get; set; }
        //
        // Summary:
        //     Social security number
        public string Ssn { get; set; }
    }

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3626 posts

    Posted 20 Aug 2019 Link to this post

    Hello, Jay, 

    In order to generate a hierarchy in RadGridView from a nested list of records in the main object of the DataSource, I would recommend you to have a look at the following KB article. It provides the possible approaches that you can follow: https://docs.telerik.com/devtools/winforms/knowledge-base/gridview-build-hierarchy-from-a-nested-list

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    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.
  3. Jay
    Jay avatar
    11 posts
    Member since:
    Mar 2019

    Posted 20 Aug 2019 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Your response moves me in the right direction, but does not quite get me to the destination that I am seeking. I want to actually embed the sub-grid within the grid cell that contains the master record such that I have a column of sub-grids instead of a stack of sub-grids underneath the master row. I want a single cell to contain the complete entity that the cell represents instead of having to drill-down/expand to a new table to represent the entity.
  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3626 posts

    Posted 21 Aug 2019 Link to this post

    Hello, Jay, 

    By design, RadGridView offers two types of hierarchy:

    - Self-reference hierarchy: In the cases when the hierarchical data is build from one type of items you can use a self-referencing RadGridView to display the data. This modes gives you all the functionality a TreeList control would provide, with a lot more.



    - Master-Detail hierarchy: In this case RadGridView has as many levels as you need where each level represents a different schema containing the respective columns. Each level is a separate template.



    It seems that the Self-reference hierarchy is close to the design you need. However, it requires identical records as type which share the same columns. 

    An alternative approach that I can suggest is to have a look at RadTreeView which may be suitable for your case. It is possible to extend the default design by creating custom nodes

    Feel free to use this approach which suits your requirements best.

    Should you have further questions please let me know.

    Regards,
    Dess | Tech Support Engineer, Sr.
    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.
  5. Jay
    Jay avatar
    11 posts
    Member since:
    Mar 2019

    Posted 21 Aug 2019 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Maybe I need to look at a different component in the DevCraft UI Suite then, as I am trying to get something similar to the attached image.

    Thank you for your assistance.

  6. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3626 posts

    Posted 21 Aug 2019 Link to this post

    Hello, Jay,  

    The provided sample screenshot is greatly appreciated. In order to get a nested grid inside a cell of the main RadGridView, I would recommend you to use a GridViewMultiComboBoxColumn. It uses a RadMultiColumnComboBoxElement as an editor. It is just necessary to set the DataSource, DisplayMember and ValueMember properties of the column. Additional information how to setup the column is available in the following help article: https://docs.telerik.com/devtools/winforms/controls/gridview/columns/column-types/gridviewmulticomboboxcolumn

    Could you please give it a try and see whether it fits your scenario?

    I am looking forward to your reply.

    Regards,
    Dess | Tech Support Engineer, Sr.
    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.
  7. Jay
    Jay avatar
    11 posts
    Member since:
    Mar 2019

    Posted 21 Aug 2019 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Dess,

    I looked at the link that you supplied and determined that will not meet my needs, as I am not showing different selection options for a single value, but an entire record.

    I am trying to display data in a visual manner in the same way that someone would drill through XML nodes in that a single cell in the RadGridView can contain an entire record. Think of a row in the grid that represents a book, with columns for title, published year, author, publisher. The author cell, instead of being a text box with the author's name, is a record that contains cells for first name, last name, primary language, etc.

    I am starting to lean towards the fact that I will have to "flatten" my data, which just doesn't present as nice as being able to nest details inside of a parent record.

  8. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3626 posts

    Posted 22 Aug 2019 Link to this post

    Hello, Jay,  

    RadGridView offers the functionality for creating custom cell elements. Thus, you can construct the desired layout for the certain cells. A sample approach is demonstrated in the following help article: https://docs.telerik.com/devtools/winforms/controls/gridview/cells/creating-custom-cells

    Note that you can use a RadHostItem in the custom cell element and host any control that you need to display the author's information, e.g. RadPropertyGrid. However, note that hosting controls in the grid cells is heavy and may slow down the scrolling and will cause visual glitches as they do not support clipping. A better option would be using custom editors. Thus, you can construct the desired editor and activate it for the respective cell. 

    However, I have prepared a sample project for your reference which result is illustrated in the below screenshot:



    Note that this is just a sample approach and it may not cover all possible cases. Feel free to modify it in a way which suits your requirements best.

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    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