gooday all,
a tree has nodes, some are duplicate nodes (i.e., representing the same underlying product).
In-memory DataTable (DuplicateNodeTable) holds duplicate nodes information.
when user checks a node, UltraTree_BeforeCheck event fires, here i check to see if the node exists in DuplicateNodeTable.
if the node is one of the duplicate node in the table==>> get reference to the tree like so:
UltraTree DuplicateTree = this.dsExBar.Groups[row.Row["SchemaID"].ToString()].Container.Controls[0] as UltraTree;
try and get a reference to the node like so:
duplicateNode = DuplicateTree.Nodes[row.Row["treeHierarchyID"].ToString()];
row.Row["treeHierarchyID"].ToString(), is the nodes Key Property, i.e Tree.Nodes[string Key]
an error is thrown, "Key not found Parameter name: key"
i have made sure that the Key property is initialized correctly. why is error thrown?
thanks.
Sorted.. Thanks nevertheless.
Hi Brian,
Thanks for replying. see below;
Brian Fallon"] You cannot specify the same key to two or more nodes in the same tree, and you stated that some nodes are duplicate nodes, so I am not clear on what "duplicate" means in this context.
You cannot specify the same key to two or more nodes in the same tree, and you stated that some nodes are duplicate nodes, so I am not clear on what "duplicate" means in this context.
Tree is "Self Reference", i.e, bind to a table.
Duplicate Nodes means representing the same underlying product, key property is a unique value throughout the node collection.
Brian Fallon"] The 'Key not found' exception is thrown when no node with that key exists in *that* collection, so it would seem possible that while the key you are specifying does indeed exist, it does not belong to any node in the collection on which you are accessing it.
The 'Key not found' exception is thrown when no node with that key exists in *that* collection, so it would seem possible that while the key you are specifying does indeed exist, it does not belong to any node in the collection on which you are accessing it.
the Key definitely exists in the collection, i have written code to 'ToolTip' the key on Tree_MouseEnterElement Event... the key exists.
)> and iterate through its nodes, only Root Node, shows the key (see below)
that is why the 'Key not found' exception is thrown .
Please advise,
Regards,
R.
You cannot specify the same key to two or more nodes in the same tree, and you stated that some nodes are duplicate nodes, so I am not clear on what "duplicate" means in this context. The 'Key not found' exception is thrown when no node with that key exists in *that* collection, so it would seem possible that while the key you are specifying does indeed exist, it does not belong to any node in the collection on which you are accessing it.