This is a migrated thread and some comments may be shown as answers.

node.ParentNode.Nodes.Remove(node) is removing Parent node when the top child node is removed.

1 Answer 243 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 21 Jun 2017, 02:08 PM

I'm trying to remove a child node. This is working fine as long as it is not the top child node under the Parent

Parent

     child1

     child2

     child3

     child4

If I remove child2, 3 or 4; it works. But if I remove child1, the Parent is removed along with any remaining child nodes.

The behavior I expected is that I should be able to remove any of the child nodes in any order and the Parent node should be removed only when the last remaining child node is removed - but even that is debatable since what if I wanted to add more child nodes to the Parent node after removing everything?

 

Here is my code:

Dim remove_node As RadTreeNode = rtvClientSpecs.FindNode(Function(x) x.Value = e.CommandArgument.ToString())           remove_node.ParentNode.Nodes.Remove(remove_node)

 

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 21 Jun 2017, 05:13 PM
I figured this one out as well, thanks.
Tags
TreeView
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or