Skip to content

Treeview doesn't update after treenode.remove

Eyal Lewin

Asked Dec 30, 2009, 12:18 AM EST3 answers
Share
LinkedInX
I've written the following code to remove a node from a treeview. The node data isremoved, butthe node is still there. Apparently I need to force a refresh, as the selected node does go away when I navigate away and back to the page.

Can anyone help?
Thanks
Eyal

C#
 //removes the node from the DB
 int remove = SchemaDB.DeleteGenericLink(originNode.Tag),TargetNode.Tag);

                if (remove)
                {
                    originNode.Remove();                   
                }
//this if, doesnt remove the originNode from the targetNode.Nodes

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Use this code:

    if (remove)
    {
       originalNode.Remove();
       treeView1.Refresh();
    }

    Thanks
    0
  • 0
    nice try,
    i wouldn't like to refresh the tree after every remove though.
    :)
    0
  • -1
    nice try,
    i wouldn't like to refresh the tree after every remove though.
    :)
    -1