Gridview - Adding a third hierarchy or level

4 posts, 0 answers
  1. Gonzalo
    Gonzalo avatar
    76 posts
    Member since:
    Oct 2012

    Posted 01 Mar 2012 Link to this post


    How would I add a 3rd. level hierarchy programmatically? Could you provide a small example or example 511493?

    +row 1
    +child row 1
    + child row 2

    Best regards,


  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Mar 2012 Link to this post


    Yes, you can add additional levels. You will need to simply add a new template and relation to the child template in the same way as you would add one to the master template.

    An example depends on how you wish to bind or add your data. Please have a look at the help topic which will guide you in doing this. Hope this helps
  3. Gonzalo
    Gonzalo avatar
    76 posts
    Member since:
    Oct 2012

    Posted 02 Mar 2012 Link to this post

    Thanks for you reply

    I am programatically building the tables and relationships

    Dim ID As New GridViewDecimalColumn()
    ID.Name = "ID"
    ID.HeaderText = "Id"
    Dim Name As New GridViewTextBoxColumn()
    Name.Name = "Name"
    Name.HeaderText = "Name"
    Name.Width = 100
    Dim Under_Appeal As New GridViewCheckBoxColumn()
    Under_Appeal.DataType = GetType(Boolean)
    Under_Appeal.Name = "Under_Appeal"
    Under_Appeal.HeaderText = "Under Appeal"
    Dim Terminated As New GridViewCheckBoxColumn()
    Terminated.DataType = GetType(Boolean)
    Terminated.Name = "Terminated"
    Terminated.HeaderText = "Terminated"
    Dim Hash As New GridViewDecimalColumn()
    Hash.Name = "Hash"
    Hash.HeaderText = "#"
    RadGridView1.Rows.Add(1, "John", True, True)
    RadGridView1.Rows.Add(2, "Mary", True, False)
    RadGridView1.Rows.Add(3, "Peter", False, True)
    Dim template As New GridViewTemplate
    template.Columns.Add(New GridViewDecimalColumn("ParentID"))
    template.Columns.Add(New GridViewTextBoxColumn("TEXT"))
    template.Columns.Add(New GridViewDecimalColumn("PRICE"))
    Dim relation As New GridViewRelation(RadGridView1.MasterTemplate)
    relation.ChildTemplate = template
    relation.RelationName = "PersonProduct"
    template.Rows.Add(1, "sugar", 2.0)
    template.Rows.Add(1, "cake", 12.0)
    template.Rows.Add(1, "butter", 3.0)
    template.Rows.Add(2, "cake", 12.0)
    Dim template2 As New GridViewTemplate
    template2.Columns.Add(New GridViewDecimalColumn("ParentID2"))
    template2.Columns.Add(New GridViewTextBoxColumn("TYPE"))
    template2.Columns.Add(New GridViewDecimalColumn("QTY"))
    Dim relation2 As New GridViewRelation(RadGridView1.MasterTemplate.Templates(0))
    relation2.ChildTemplate = template2
    relation2.RelationName = "PersonProduct2"
    template2.Rows.Add(1, "brown", 1)
    template2.Rows.Add(1, "whiter", 3)
    template2.Rows.Add(2, "banana", 2)
    I am getting errors at runtime when I try to see the 3rd level in the hyerarchy. This is just a test. 
    Best regards,


  4. Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 07 Mar 2012 Link to this post

    Hello Gonzalo,

    We found some issues with building hierarchy mode in unbound mode using your scenario. The issue is logged in our Public Issue Tracking System. It will be addressed in Q1 2012 SP1 release, planned for mid-March. Currently, you can use DataTable to prepare your data and build hierarchy in bound mode.

    For examples of bound hierarchy, please open our Demo application, which can be found in the Telerik folder in your Start Menu and navigate to RadGridView > Hierarchy

    Thank your time and cooperation. Your Telerik points have been updated.

    All the best,
    Julian Benkov
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top