Solved

Dynamic treeview - (create usercontrol??)

Posted on 2007-12-04
6
968 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 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