Hello,
I am trying to work with my first treeview. When the page displays all of the nodes (parents and child) are displayed as Child nodes.
I found an example of dynamically adding nodes, but on one particular line I get an error where they obviously do not. How do I differentiate between parents and children? (below is a code snipet)
Dim pNode As TreeNode
Dim pChild As TreeNode
...
pNode = New TreeNode()
pNode.Text = DW 'DW equal to parent text
ApWireT.Nodes.Add(pNode) 'ApWireT is the name of the treeview control
For i = 0 To 20 ' Loop through setting up child nodes
If Mid(ApTab(i), 1, 2) = "ZA" Or Mid(ApTab(i), 1, 2) = "ZB" Then
SearchSub = "Z0"
Else
SearchSub = Mid(ApTab(i), 1, 2)
End If
pChild = New TreeNode()
pChild.Text = Mid(ApTab(i), 4, 50)
ApWireT.Nodes.Add(pChild)
The example code I have shows the line directly above as:
pNode.Nodes.Add(pChild), but I get an error stating "Nodes is not a member of 'System.web.ui.webcontrols.treenode".
Can anyone help?
Thanks