Hi,
I want to add Child and Parent node in the same name(e.g Node1). It is giving exception as key already exist.
UltraTreeNode parentNode= new UltraTreeNode("Node1");
UltraTreeNode childNode= new UltraTreeNode("Node1");
parentNode.Nodes.Add( childNode);
Only name(key) is same as Parent and Child node, and it throws exception.
Could you please let me know to add Child node with same name.
Node keys have to be unique across the entire tree.So you can't have two nodes with the same key, even if those nodes are on different levels.
There is no such restriction on the Text property of the node, though. So you can have the same text on as many nodes as you want.
Thanks Mike.
Is there any way to generate different keys(for nodes at different levels), from the WinTree?
dotnet_santosh said:Is there any way to generate different keys(for nodes at different levels), from the WinTree?
I'm not sure what you mean. There's no way for the tree to automatically generate keys for you, if that's what you mean. You could, of course, create unique keys by combining the key of the parent and child together.
Also, you do not have to specify a Key at all. You can add nodes to the tree with NO key, and then there will be no problem with duplicates. The down side of this is that you can't use the GetNodeByKey method to find a node in the tree.