Deleting Nodes in Treeview Control

Deleting Nodes in Treeview Control

am 11.04.2008 10:20:03 von miketayloruk

I'm trying to delete/remove the selected node of a treeview.

What I'm finding is that I cant delete a node unless it is a root
node. For example in the example below, I can delete complete branches
as long as I select "leve 1" nodes.

If I try to delete at Level 2, it doesnt work.

Whay is this? How can I delete nodes that are further down the
branchs?

Thx in advance:

--------------------

<%@ Page Language="VB" %>

www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">





Untitled Page











asp:TreeNode>




asp:TreeNode>

asp:TreeNode>




OnClick="Button1_Click" Text="Delete Selected Node" />


Re: Deleting Nodes in Treeview Control

am 11.04.2008 11:10:15 von miketayloruk

I figured it out:

TreeView1.SelectedNode.Parent.ChildNodes.Remove(TreeView1.Se lectedNode)

Thx
--------------------------------------------

On Apr 11, 9:20=A0am, miketaylo...@gmail.com wrote:
> I'm trying to delete/remove the selected node of a treeview.
>
> What I'm finding is that I cant delete a node unless it is a root
> node. For example in the example below, I can delete complete branches
> as long as I select "leve 1" nodes.
>
> If I try to delete at Level 2, it doesnt work.
>
> Whay is this? How can I delete nodes that are further down the
> branchs?
>
> Thx in advance:
>
> --------------------
>