my application requires refreshing nodes in ultra tree. I want to remove or hide some nodes with specific attributes. One of the deleted nodes is the first node added to the tree.
If I set that node visible = false I get the following error:
"The ActiveNode can only be set to a node that belongs to this control."
If I try to remove that node, I get error:
"Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index"
Here is my code:
- Create a new UltraTree with name ultraTree1
void createTree() { //the following code causes problem ultraTree1.BeginUpdate(); ultraTree1.Nodes.Clear(); ultraTree1.Focus(); UltraTreeNode _n1 = ultraTree1.Nodes.Add("node 1"); UltraTreeNode _n2 = ultraTree1.Nodes.Add("node 2"); ultraTree1.ActiveNode = null; //_n1.Visible = false; _n1.Remove(); //the code causing problem ultraTree1.EndUpdate(); }
and the main class:
public Form1() { InitializeComponent(); createTree();//works ok createTree(); //get error }
I found out that BeginUpdate() and EndUpdate() cause these errors. It works ok if I comment out BeginUpdate() and EndUpdate(). However, I want to use these methods because my tree has considerable large number of nodes.
Do you have any hot fix for that issue ???
I use Infragistics 9.1
There was a recent fix that was applied to 2008.3 and later that might have addressed this;
you should download the latest version and see if it solves the problem.
If it doesn't, report it as a bug and in the meantime, try moving the call to the Remove method outside the BeginUpdate/EndUpdate block.
thanks lads for feedback.
I get the latest version and it works now.