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
4165
.Remove Node is leaving node in collection
posted

Hi,

It is hard to explain this issue but I will give it a shot. 

I have some nodes like this that i build dynamically 

All Items

    Test1

        Parts

            Part1

            Part2

            Part3

A user can click on Part2 and delete. We call ActiveNode.Remove(). We then set the active node to the parent by saying Tree.ActiveNode to the Test1 node.

I collapse the Test1 Node.

On the before expand method we have a method that builds the child nodes. So the first thing it does is 

e.TreeNode.Nodes.Clear();

Then I check for the existence of that Parts node. If it was not there for some reason we rebuild it (because if I was expanding from the root node it would not be there).

if(!e.Node.Exists("parts"))

{

UltraTreeNode n = e.Nodes.Add("parts");///ERROR


}

I get an error on that line that it already exists. But the exists returned false! Furthermore if i do this

UltraTreeNode n = treeView.GetNodeByKey("parts");

it returns a reference…but if you browse that object it is all screwy…for instance 'Parent' is null.

So I read somewhere that you have to call ActiveNode.Dispose()

http://ko.infragistics.com/community/forums/t/36985.aspx

I did this but it does not actually remove the node from the UI…stays on the screen. So to get around this after I remove the node I programatically collapse the parent node. This seems to fix the problem but I am not confident now that nodes are properly being disposed off. Plus it is bad for the user to have to expand the node to get back to the parts.


It is further weird because the node being removed is not the node giving us the trouble.

THanks,Mele