Hi all,
I'm trying to populate a treeview control in my asp.net environment from reports in sql server reporting services.
I almost have it done... With the code I am using I am getting it to populate, but every node is at top level, I can't get it to add the child nodes.
What could be wrong?
This is my code thusfar:
VB Code:
Protected Sub LoadTree(ByVal items As NetcashReportService.CatalogItem()) rs.Credentials = nc TreeReports.Nodes.Clear() For Each item As NetcashReportService.CatalogItem In items Dim parts As String() = item.Path.Split("/".ToCharArray) Dim path As String = "" Dim lastNode As TreeNode = Nothing Dim lastPart As String = "" For Each t As String In parts lastPart = t If Not (path = "") Then path += "/" End If path += t Dim tn As TreeNode = TreeReports.FindNode(path) lastNode = tn Next Dim newNode As TreeNode = New TreeNode(lastPart) If lastNode Is Nothing Then TreeReports.Nodes.Add(newNode) Else lastNode.ChildNodes.Add(newNode) End If Next SetTreeLinks(TreeReports.Nodes) 'TreeReports.ExpandDepth = 1 End Sub




Reply With Quote