Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a treeview that is bound to sql table.and in the right hand side of my treeview i have two buttons ,one for move the nodes upper,and the other is to move them down.and it works perfectly.but i want to save the position of the nodes . for example when i move the node up ,i want that to be saved in my table,so that the next time i open the webpage, the appearance of the nodes be the same as when i closed my page.i mean when users make changes,it should be saved .
Posted
Comments
Sergey Alexandrovich Kryukov 12-Aug-11 17:10pm    
Not really a question. Of course you can do it. What seems to be a problem?
--SA

1 solution

You didn't actually ask a specific question, but if the problem is in modeling the underlying table:

In order to save the position of the nodes in the database you could have a table defining the node relations. One way to do this is to use a table with a self-join. For example (pseudo code):
table MyNodes
   NodeId    --primary key
   Position  --position in the treeview, starting from 0/1 for each parent
   ParentId  --Foreign key to NodeId, null if it is a root node
   ...other columns describing the node, perhaps user etc...

By using this kind of structure you can define the order of nodes at any level of your tree.

Most likely you have to fill the treeview by hand because the direct binding may not be capable of handling the database structure, but that depends on the mechanism you have used.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900