Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
765
Key Already Exists
posted

I"m trying to get a better understanding on what is going on. 

First I'm experiencing a Key Already Exists exception when I add a node to a parent node using parentnode.Add(newNode).  From what I understand each node has its own TreeNodesCollection which is the Nodes structure.  Now if I do:

parentNode.Exists(newNode.Key) I will get false prior to getting this exception using the Add.

 However I do know that somewhere else in this tree with a different parent is is a node with the same key.  So once a node is added to a tree, is there some kind fo master key structure in the tree that keeps track of all nodes?   I figured as long as each parent had its own nodes collection then they just had to have unique children.  I also create all of my own keys.

Please enlighten me on what is going on.

Parents
No Data
Reply
  • 907
    posted

    Keys are unique to the entire tree control, not a node.  You need to use the function on the tree itself to verify whether a key exists or not, rather then the node collections.

Children