I've tried to reproduce the error:
The ASPX code with 3 treeviews and one context menu for all of them:
Height=\"200px\" ContextMenuID=\"contextMenu\">
Height=\"200px\" ContextMenuID=\"contextMenu\">
Height=\"200px\" ContextMenuID=\"contextMenu\">
And the same code-behind as yours, but with some modifications (just to make it work):
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
'If Not Session(\"BrowseFolderPermissions\") Is Nothing Then
' labShare.Text = Session(\"BrowseFolderPermissions\").ToString()
ResolveFirstLevel(treeDirectories, \"c:\\program files\")
ResolveFirstLevel(treeDirectories1, \"c:\\program files\")
ResolveFirstLevel(treeDirectories2, \"c:\\program files\")
'End If
End If
End Sub
Private Sub ResolveFirstLevel(ByVal treeview As FlyTreeView, ByVal sharePath As String)
Dim rootNode As New FlyTreeNode(HttpUtility.HtmlEncode(sharePath.ToUpper), sharePath.ToUpper)
rootNode.NodeTypeID = \"Root\"
rootNode.CanBeSelected = False
rootNode.PopulateNodesOnDemand = True
treeview.Nodes.Clear()
treeview.Nodes.Add(rootNode)
AddSubFolders(rootNode, sharePath)
End Sub
Private Sub AddSubFolders(ByRef fathernode As FlyTreeNode, ByVal fatherpath As String)
Dim dirs() As String
dirs = Directory.GetDirectories(fatherpath)
Dim objDir As DirectoryInfo
Dim newNode As FlyTreeNode
For Each dir As String In dirs
objDir = New DirectoryInfo(dir)
newNode = New FlyTreeNode(HttpUtility.HtmlEncode(objDir.Name), objDir.FullName)
newNode.NodeTypeID = \"Dir\"
Dim splitted() As String = objDir.FullName.Split(\"\\\")
fathernode.ChildNodes.Add(newNode)
newNode.PopulateNodesOnDemand = splitted.GetLength(0) 0
Next
End Sub
Protected Sub treeDirectories_PopulateNodes(ByVal sender As Object, ByVal e As NineRays.WebControls.FlyTreeNodeEventArgs)
AddSubFolders(e.Node, e.Node.Value)
End Sub
And it works ok. Postback also succeeds. No errors.
Could you please change something within the code to reproduce the error, so we can test it here and finally find the problem?