473,386 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

TreeNodeExpanded

Hi all,

I have a page that has a very large organizational tree, since it was
taking a while to load, I altered the tree to dynamically build itself
using the TreeNodeExpanded event. This significantly improved
performance and worked well until I noticed a strange behavior. The
tree worked exactly the same except when a node was checked. When the
user checked any node, then expanded a new node, all of the checked
nodes moved to the root level of the tree, regardless of how deep they
were in the tree. If the user then tried to un-expand a node, then the
tree would show itself as normal with the expanded node un-expanded.
If the user tried to un-expand a checked node, the tree moves the
expanded node back to where it should be, but it remains expanded. If
the user clicks the same node a third time, it un-expands at it should.

Example:

Initial tree state (ExpandDepth set to 1). When everything is
un-checked, the tree works as expected.
[-] [ ] <root>
[+] [ ] <node 1>
[+] [ ] <node 2>
[+] [ ] <node 3>

User expands node 1 while node 1 is checked. All checked items are
moved to the root level.
[-] [ ] <root>
[-] [X] <node 1>
[+] [ ] <node 1_1>
[ ] <node 2_2>
[+] [ ] <node 2>
[+] [ ] <node 3>

User tries to un-expand node 1, node 1 moves back under root node where
it belongs. Node 1 remains expanded.
[-] [ ] <root>
[-] [X] <node 1>
[+] [ ] <node 1_1>
[ ] <node 2_2>
[+] [ ] <node 2>
[+] [ ] <node 3>

User clicks to un-expand node 1 a second time, node 1 un-expands as
expected.
[-] [ ] <root>
[+] [X] <node 1>
[+] [ ] <node 2>
[+] [ ] <node 3>

Anyone seen this behavior before or have any clues?

Here is the recursive method I am using to load the tree. It is being
called by the TreeNodeExpanded event:

Private Sub loadChildren (ByVal tn As TreeNode, ByVal id As String,
ByVal dv As System.Data.DataView, ByVal levels As Int16)
If (levels = 0) Then
Exit Sub
End If
dv.RowFilter = "[parent] = " & id & " and orgId <" & id
For Each dr As System.Data.DataRow In dv.ToTable().Rows
Dim child As New TreeNode(dr("OrgSymbol"), dr("orgId"))
child.ShowCheckBox = True
child.SelectAction = TreeNodeSelectAction.None
tn.ChildNodes.Add(child)
loadChildren(child, dr("orgId"), dv, levels - 1)
Next
End Sub

TIA,
Jolly

Jan 10 '07 #1
0 1299

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: vincenzo.papa | last post by:
I' ve got a TreeView asp.net 2.0 and I'm working in "ajax" way to allow the nodes charge without the page postback. But I noticed that the TreeNodePopulate is called back just the first time tha a...
0
by: drop | last post by:
Hi, I'm currently working with the Treeview control in ASP .Net 2.0. The tree is filled dynamically based on data contained in a MySQL Database. Here is the exact behavior I want : 1 - User...
0
by: stacy | last post by:
My asp.net Web application is written in VB, using VS 2005 with Framework 2.0 I am having trouble with the SelectedNode element. The TreeView is built programmatically and looks like this: -...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.