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
320
Programmatically check duplicate nodes. v8.2
posted

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.

Parents
  • 69832
    Offline posted

    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.

Reply Children