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

N level treeview - heirarchical binding

2 Answers 51 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ganesh Shivshankar
Top achievements
Rank 1
Ganesh Shivshankar asked on 22 Mar 2011, 08:00 AM
Hi,

Can anyone let me know how to handle n-level hierarchy in a tree view?
This is my hierarchy

public class Test
{
public int Id {get; set;}
public string Name {get; set;}
public IList<Test> Children {get; set;}
}

result could be
{
   Test
   {
    - Id : 1
    - Name : One
    - Children : {
        Test
         - Id : 2
         - Name : Two
        - Children : {}
                     }
    },
   Test
   {
    - Id : 3
    - Name : Three
    - Children : {
        Test
         - Id : 4
         - Name : Four
        - Children : {
                     Test
                     - Id : 5
                     - Name : Five
                     - Children : {}
                           }
                     }
    }
}
I dont know how many levels will be returned exactly. Is this possible to handle?

Cheers,
Ganesh

2 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 22 Mar 2011, 09:20 AM
Hi Ganesh Shivshankar,

Please examine the attached solution where a basic approach is realized. It shows hierarchy of files and folders and the number of levels is unknown by design. Feel free to ask if you need further info or assistance. You can also check out this starting article and this demo.

Kind regards,
Petar Mladenov
the Telerik team
0
Ganesh Shivshankar
Top achievements
Rank 1
answered on 22 Mar 2011, 09:38 AM
Thanks Petar.

I get the idea and it works.
Tags
TreeView
Asked by
Ganesh Shivshankar
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Ganesh Shivshankar
Top achievements
Rank 1
Share this question
or