Protected Sub TreeView1_TreeNodeExpanded(ByVal sender As Object, ByVal e As TreeNodeEventArgs)
If e.Node.Parent Is Nothing Then
Return
End If
Dim tn As TreeNode = e.Node.Parent
For Each node As TreeNode In tn.ChildNodes
If Not (node = e.Node) Then
node.Collapse
End If
Next
End Sub
overriding the expanded event as shown above should resolve your first issue.
Regarding the second issue, I guess with the sitemap datasource, it is not doable. might be possible with other datasources.
ubaid1900
Participant
918 Points
187 Posts
Re: TreeView Collapse and Expand Dynamically
Nov 27, 2006 10:16 PM|LINK
Protected Sub TreeView1_TreeNodeExpanded(ByVal sender As Object, ByVal e As TreeNodeEventArgs)
If e.Node.Parent Is Nothing Then
Return
End If
Dim tn As TreeNode = e.Node.Parent
For Each node As TreeNode In tn.ChildNodes
If Not (node = e.Node) Then
node.Collapse
End If
Next
End Sub
overriding the expanded event as shown above should resolve your first issue.
Regarding the second issue, I guess with the sitemap datasource, it is not doable. might be possible with other datasources.
Hope it helped. Thanks