Dynamic treeview - (create usercontrol??)

I need to build a treeview menu BUT each user can have a different order to the treeview nodes.

The order of the nodes is in the database for each user. The text of the nodes is also in the database.

What's the best way to do this? create a usercontrol , build the treeview based on the user's node-order, bind the text of the nodes...ALL in a usercontrol...reading the node-order from teh database

 Or maybe hold the order of the nodes in a Cookie instead of going to the database all the time...

any ideas/
Who is Participating?
ChumadConnect With a Mentor Commented:
How often do the menu options and order change? If they change often, then you'd have to come up with a way to refresh the cookie after a change occurred.

Also, I don't think it would matter a lot either way if you put this in a usercontrol or directly on a page -- EXCEPT for the fact that if you need this menu on many pages across your site you'd have to duplicate code. So if you need it on many pages, put it either in a user control or in a master page.

As far as the technique, it sounds like you've thought it out a bit. My personal preference would be to get it from the database each time instead of from a client-side cookie -- unless of course the menu was HUGE and you were expecting 100's to thousands of simultaneous users, at which point I'd consider caching it in the session.
CamilliaAuthor Commented:
the order of the menu is set once for each user. Doesnt change reguarly. maybe once or twice but usually, it's a one time thing...

Menu is only 40 nodes. At most, maybe 100 users at peak time .

Menu will only be on one page. My code has masterpage, so maybe i'll stick with master-page and just have it there...

Just look at all the pro's and con's:

1. If you query the database each time and you have LOTS of users, you might notice a slowdown of the site (it would take a very large number of users before you'd notice anything.) Plus is that it's easy to do and just as easy to maintain.

2. If you use a cookie, the data could get stale.  Also, reading a cookie could prove tricky depending on the situation. A plus to this is that you wouldn't be using up a lot of system resources for this method.

3. If you use a session, you gain from the fact that you don't have to query the database on every page hit; however, you will be using up system RAM to store the session value for each user.
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

CamilliaAuthor Commented:
thanks, session might not be bad idea... suppose 100 users, 40 rows of data that's char(3).
Just wondering if you'll be awarding points on this one or not :)
CamilliaAuthor Commented:
yes, sorry. was just logging in to assign points. Thanks for you help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.