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
490
How to remove a node and all of its children from an UltraTree
posted

I tried with several versions of this clean method, but couldn't succeed to remove all the child nodes of the node that I want to remove.

private void Clean(UltraTreeNode node)
        {
            while (node.Nodes.Count > 0)
            {
                this.Clean(node.Nodes[0]);
            }
            node.Remove();
            if (this.NavigationTree.Nodes.Contains(node))
                this.NavigationTree.Nodes.Remove(node);

        }

When I want to add a new node with the same key as a node that I think to be cleaned, I still get key already exists exception.

Parents
No Data
Reply
  • 23930
    Verified Answer
    Offline posted

    Hello Burak,

    Thank you for contacting Infragistics Developer Support.

    I have tried to reproduce your issue using 14.1 (v 14.1.20141.2019) and using the UltraTree.Nodes.Remove(node) method worked fine for me – I could then add the very same node again. What version of Infragistics are you using? I have attached my sample. If this approach doesn’t work for you, please modify it so that it to reproduces your issue and send it back to me.

    I am looking forward to your reply.

    WT_DragAndRemoveNode.zip
Children