N level treeview - heirarchical binding

3 posts, 1 answers
  1. Ganesh Shivshankar
    Ganesh Shivshankar avatar
    78 posts
    Member since:
    Sep 2009

    Posted 22 Mar 2011 Link to this post

    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. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 22 Mar 2011 Link to this post

    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
  3. DevCraft banner
  4. Ganesh Shivshankar
    Ganesh Shivshankar avatar
    78 posts
    Member since:
    Sep 2009

    Posted 22 Mar 2011 Link to this post

    Thanks Petar.

    I get the idea and it works.
Back to Top