[RESOLVED] - Treeview - Not Populating when Node.Depth = 2
I have node.depth 0 & 1 populating correctly but 2 will not populate. For some reason when I step through the code it thinks it is still at depth 1. Any help would be appreciated.
HTML Code:
<asp:TreeView ID="tvVSS" OnTreeNodePopulate="PopulateNode" SkinID="MSDN" Width="250" ExpandDepth="1" runat="server" MaxDataBindDepth="3" >
<Nodes>
<asp:TreeNode Text = "SourceSafe Directory" SelectAction="Expand" PopulateOnDemand="True" Value="SourceSafe Directory" />
</Nodes>
</asp:TreeView>
VB Code:
Sub GetClient(ByVal node As TreeNode)
Dim thisItem As SourceSafeTypeLib.IVSSItem
vsDB = New SourceSafeTypeLib.VSSDatabase
vsDB.Open(strVSSDB, strVSSUser, strVSSPW)
strCurrentPrj = "$/client_import/"
vsDB.CurrentProject() = strCurrentPrj
Try
For Each thisItem In vsDB.VSSItem(vsDB.CurrentProject).Items(False)
If thisItem.Type = VSSITEM_PROJECT Then
Dim newNode As TreeNode = New TreeNode(thisItem.Name)
newNode.SelectAction = TreeNodeSelectAction.Expand
newNode.PopulateOnDemand = True
node.ChildNodes.Add(newNode)
End If
Next
Catch ex As Exception
'Put error handling here
End Try
End Sub
Sub GetVersion(ByVal node As TreeNode)
Dim thisItem As SourceSafeTypeLib.IVSSItem
vsDB = New SourceSafeTypeLib.VSSDatabase
vsDB.Open(strVSSDB, strVSSUser, strVSSPW)
Client = node.Value
strCurrentPrj = "$/client_import/" & Client & "/PROCESSES/"
vsDB.CurrentProject() = strCurrentPrj
Try
For Each thisItem In vsDB.VSSItem(vsDB.CurrentProject).Items(False)
If thisItem.Type = VSSITEM_PROJECT Then
Dim newNode As TreeNode = New TreeNode(thisItem.Name)
node.ChildNodes.Add(newNode)
End If
Next
Catch ex As Exception
End Try
End Sub
Sub GetProcess(ByVal node As TreeNode)
Dim thisItem As SourceSafeTypeLib.IVSSItem
vsDB = New SourceSafeTypeLib.VSSDatabase
vsDB.Open(strVSSDB, strVSSUser, strVSSPW)
Version = node.Value
strCurrentPrj = "$/client_import/" & Client & "/PROCESSES/" & Version
vsDB.CurrentProject() = strCurrentPrj
Try
For Each thisItem In vsDB.VSSItem(vsDB.CurrentProject).Items(False)
If thisItem.Type = VSSITEM_PROJECT Then
Dim newNode As TreeNode = New TreeNode(thisItem.Name)
node.ChildNodes.Add(newNode)
End If
Next
Catch ex As Exception
End Try
End Sub
Sub PopulateNode(ByVal source As Object, ByVal e As TreeNodeEventArgs)
Select Case e.Node.Depth
Case 0
GetClient(e.Node)
Case 1
GetVersion(e.Node)
Case 2
GetProcess(e.Node)
End Select
End Sub