Solved

Dynamic treeview - (create usercontrol??)

Posted on 2007-12-04
6
966 Views
Last Modified: 2012-06-27
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/
0
Comment
Question by:Camillia
  • 3
  • 3
6 Comments
 
LVL 8

Accepted Solution

by:
Chumad earned 500 total points
ID: 20406843
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.
0
 
LVL 7

Author Comment

by:Camillia
ID: 20406911
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...

0
 
LVL 8

Expert Comment

by:Chumad
ID: 20406964
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.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Author Comment

by:Camillia
ID: 20407648
thanks, session might not be bad idea... suppose 100 users, 40 rows of data that's char(3).
0
 
LVL 8

Expert Comment

by:Chumad
ID: 20414098
Just wondering if you'll be awarding points on this one or not :)
0
 
LVL 7

Author Comment

by:Camillia
ID: 20414169
yes, sorry. was just logging in to assign points. Thanks for you help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now