Hi!
We use an UltraTree that uses a DataSet as DataSource (via a BindingSource).
We also use the UltraTree.InitializeDataNode(...) event for setting the node.Key values.
We utilize a call to tree.GetNodeByKey(...) together with the property node.FullPath in order to display the full tree path elsewhere. Unfortunately it seems tree.GetNodeByKey(...) returns Nothing for all nodes that have not yet been expanded in the view.
Appearently only the nodes that are, or have been, expanded have had the InitializeDataNode event called. Can you confirm this behavior?
Can you also suggest a method of "initializing" all node keys of the tree from the start? Is there an easy way to force this or should we do a full traverse of the tree?
Thanks in advance for any help.
-Ulf
Hi Ulf,
That is correct. The tree loads the nodes from the data source on-demand, for efficiency. It would be inefficient to load all of the nodes up-front, since some of those nodes might never be expanded by the user.
If you want to force all of the nodes to get loaded, you could write a recursive loop to simple access the Nodes.Count of each parent node.
Hi Mike,
My problem is that when the treenode is selected as desktop
then the double cilcking on the folder of the desktop is giving the node as null
my code
.explorerUltraTree.GetNodeByKey(C:\Documents and Settings\user_1\Desktop\Folder1);
so my node folder is not opening.
Please suggest the solution
Hi,
Well, it's hard to be sure, but my guess is that the Desktop node has not yet loaded it's child nodes, so therefore the node with the appropriate key does not exist. There's no way that tree can know that this node will exist later.
If you have a reference to the Desktop node, you reference it's Count property to force it to load it's child nodes.
Or, as I said above, you could loop through all of the nodes in the tree recursively and access the Count property on each parent node in order to force everything to load from the data source all at once.