I have version 2009.2 and I am running into the same problem. I can loop through all of the nodes and their child nodes and find the node that I am trying to activate but it gives me the error. Here is my code
It reaches the if (parentNode.Nodes.Contains(_clickedNode)) and it returns true but as soon as I hit the line ActiveNode = parentNode.Nodes[_clickedNode.Index]; it errors out with "The ActiveNode can only be set to a node that belongs to this control."
private void SetNodeAsActive(UltraTreeNode parentNode, UltraTreeNode clickedNode)
{
if (parentNode.Nodes.Contains(_clickedNode))
this.SelectedNode.Nodes.Clear();
parentNode.Nodes[_clickedNode.Index].Selected = true;
ActiveNode = parentNode.Nodes[_clickedNode.Index];
}
else
foreach (var parentNodes in parentNode.Nodes)
SetNodeAsActive(parentNodes, clickedNode);
I have also tried and I get the error as well
_clickedNode.Selected = true;
ActiveNode = _clickedNode;
At a glance the obvious explanation is that parentNode does not belong to any Nodes collection associated with the control. If you have ruled out this possibility and are able, please attach a sample project that demonstrates the problem, as this is not reproducible with a simple test.
Is there anyone who can help on this. This is causing part of our software not to be implemented in production. PLEASE HELP!!!!!