• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

Sort Treeview Control

Is there a way to sort a Treeview control other than the Node Text?  I store the tree structure in a database as ID, Description, ParentID, and SequenceNumber.  I'd like the tree to sort by the SequenceNumber.  Is this possible?  An example would greatly help.
0
johnczimm
Asked:
johnczimm
  • 2
  • 2
  • 2
1 Solution
 
nungaCommented:
Set the Sorted property of the Treeview control to False.

Then add the nodes in the order you want them to appear, ie sort your recordsource by the SequenceNumber then add them to the control in that order.
0
 
johnczimmAuthor Commented:
The problem that I have is that the tree has already been populated and it has over 1500 nodes in it.  I can't go back and re-enter all the nodes.
0
 
nungaCommented:
Sorry, I'm not sure I completely understand what you're saying.

What do you mean by the tree has already been populated? Don't you generate the tree from the records in the database?

When you say 're-enter all the nodes' do you mean entering the records into the database?

Thanks.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
amebaCommented:
When retrieving records from table, add
" ORDER BY SequenceNumber"
to your sql statement. Also, add index with 'SequenceNumber' to your table.
0
 
johnczimmAuthor Commented:
I figured out a workaround to my problem.  Sorry I didn’t explain the problem very well.  Ameba’s comment was fairly close to the workaround, so you can have the points.  Thanks.
0
 
amebaCommented:
>you can have the points.
I didn't ask for your points. I Hate "C"!
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now