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

AddNodeByPath

2 Answers 61 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
dannyyy
Top achievements
Rank 1
dannyyy asked on 22 May 2008, 07:13 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Jordan
Telerik team
answered on 23 May 2008, 07:29 AM
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
0
dannyyy
Top achievements
Rank 1
answered on 23 May 2008, 07:37 AM
Thank you very much!

Now it's working as well.
Tags
Treeview
Asked by
dannyyy
Top achievements
Rank 1
Answers by
Jordan
Telerik team
dannyyy
Top achievements
Rank 1
Share this question
or