TreeView expand

liptonIcedTea

Well-known member
Joined
Jan 18, 2007
Messages
89
Programming Experience
1-3
Hi,

I have a TreeView in one of my Web Forms with a set of nodes. When I select a node, the form reloads itself.

But when it does, it collapses all the nodes and leaves just the root node. I'm wondering, is it possible for it to remember which nodes were expanded and collapsed?
 
just to add, i think this is happening because i'm clearing the nodes each time

eg.

TreeView1.clear()

but the thing is, if I don't do that, it'll duplicate the old nodes.
 
One usually only populate the Treeview first time page loads, not in postbacks:
VB.NET:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        If Not IsPostBack Then
            ' populate treeview
        End If
    End Sub
 
Back
Top