AddNodeByPath

3 posts, 1 answers
  1. dannyyy
    dannyyy avatar
    10 posts
    Member since:
    May 2007

    Posted 22 May 2008 Link to this post

    Hello,

    I've a question about the AddNodeByPath method.

    I get an array with the following content (datatype is string)

    Switzerland
    Switzerland/Bern
    Switzerland/Zurich
    Switzerland/Zurich/Bulach
    Switzerland/Zurich/Bulach/Opfikon
    Switzerland/Zurich/Uster
    ...

    And I'd have the following hirarchie:

    -Switzerland
    |-Bern
    |-Zurich
     |-Bulach
      |-Opfikon
     |-Uster

    But when I use this code I get some other structure:

    foreach (string city in cities)
    {
      radTreeView1.addNodeByPath(city, "/");
    }

    Can you help me to give an easy solution for that? I don't want to solve it by recursion and other more complex algorithms.

    Thank you in advance
    Danny Meier
  2. Answer
    Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 23 May 2008 Link to this post

    Hello dannyyy,

    Indeed, there seems to be an issue in the AddNodeByPath method. However, there is a very easy solution:

    this.radTreeView1.PathSeparator = "/"
    foreach (string nodePath in nodes) 
        this.radTreeView1.AddNodeByPath(nodePath); 

    Please note how the path separator is set to the RadTreeView and not used as a second parameter later.

    I hope this helps. If you have additional questions, please contact me.

    All the best,
    Jordan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. dannyyy
    dannyyy avatar
    10 posts
    Member since:
    May 2007

    Posted 23 May 2008 Link to this post

    Thank you very much!

    Now it's working as well.
Back to Top