strange treeview behaviour

C

coynej60

I have a number of treeviews on a webpage which are populated with a
couple of links as child nodes at runtime. The problem I am having is
when I click on the root node of any of the trees I get the same page
except I now have 2 of each tree! I have not been able to find anyone
else who is having this issue. See below the code I use to populate
the trees. Has anyone else had this problem and have a solution?


1)
....
reader = cmd.ExecuteReader()
Dim root As New TreeNode("Tests and Procedures")
root.NavigateUrl = ""
'build the tandp related content tree
While (reader.Read() And i < 3)
i = i + 1
Dim nodeChild As New TreeNode
nodeChild.Text = reader.Item("page_title")
nodeChild.NavigateUrl = "content.aspx?pageid=" &
reader.Item("pageid")
root.ChildNodes.Add(nodeChild)
'create the "More Tests and Procedures" tree node
End While
If (root.ChildNodes.Count > 0) Then
treeTandP.Nodes.Add(root)
treeTandP.Visible = True
End If
treeTandP.CollapseAll() 'collapse the tree to start with


Note I have tried setting the navigateurl property to an empty string
as well as not changing the property from it's default value and get
the same result either way.


thanks,

Jake
 
C

coynej60

coynej60 said:
I have a number of treeviews on a webpage which are populated with a
couple of links as child nodes at runtime. The problem I am having is
when I click on the root node of any of the trees I get the same page
except I now have 2 of each tree! I have not been able to find anyone
else who is having this issue. See below the code I use to populate
the trees. Has anyone else had this problem and have a solution?


1)
...
reader = cmd.ExecuteReader()
Dim root As New TreeNode("Tests and Procedures")
root.NavigateUrl = ""
'build the tandp related content tree
While (reader.Read() And i < 3)
i = i + 1
Dim nodeChild As New TreeNode
nodeChild.Text = reader.Item("page_title")
nodeChild.NavigateUrl = "content.aspx?pageid=" &
reader.Item("pageid")
root.ChildNodes.Add(nodeChild)
'create the "More Tests and Procedures" tree node
End While
If (root.ChildNodes.Count > 0) Then
treeTandP.Nodes.Add(root)
treeTandP.Visible = True
End If
treeTandP.CollapseAll() 'collapse the tree to start with


Note I have tried setting the navigateurl property to an empty string
as well as not changing the property from it's default value and get
the same result either way.


thanks,

Jake

Answered my own question

root.SelectAction = TreeNodeSelectAction.None

solved my problem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top