How to Collapse all the nodes of a tree view?

  • Thread starter Luis E Valencia
  • Start date


Luis E Valencia

How to Collapse all the nodes of a tree view?

Private Sub TreeView1_Expand(ByVal sender As Object, ByVal e As
Microsoft.Web.UI.WebControls.TreeViewClickEventArgs) Handles

Dim nodo As TreeNode

Dim nodoactual As TreeNode


nodoactual = CType(sender, TreeNode)

For Each nodo In TreeView1.Nodes

If Not nodo.Equals(nodoactual) Then

nodo.Expanded = False

End If


End Sub

It didnt work.

I have many root nodes, If I open one and then open another root node the
last one must close


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question