Globa Variables And TreeViews

G

Guest

I created a web page that everytime I open the page, the treeview gets
populated with literally thousands of data, taking more than three minutes to
create the page. I am beginning to find this very annoying!

Is it a good idea to have this Treeview populated and assign to a variable
(Application or global <Object> variable) so that it can be used throughout
the site? The variable will also change with new data is added to the it in
the web page.

I'm curious if this a resource issue. I read that Application variables are
not good if you assign objects to it. It has something to do with threads.

Thanks in advance.
 
K

Kevin Spencer

Well, you have 2 problems here. One is that your treeview has too much data
in it. The other is the amount of time it takes to build it. What do I mean
by that? Well, by "too much data" I mean that an HTML document takes a
certain amount of time to load from the server, due to network latency
issues, bandwidth, etc. You should check out how much HTML is being
generated with each page. Chances are, it's too much.

The second problem, the one you mentioned in your message, is how long it
takes to build the data and treeview. The real question is, is the delay due
to the amount of time it takes to build the object, or is it due to the
amount of HTML being streamed to the browser, or is it both?

Now, you should be able to view the source HTML of the document that gets
returned, and tell how bit it is, in bytes (save the HTML as a text document
and view the file size). If it's over 200K of data, it's probably too big,
and you may have to redesign your app to use less data per page. Another
solution, if you don't want to go that route, is to use a FrameSet, so that
the treeview lods into a frame that doesn't get reloaded, and the other
frames do.

If the source HTML is small enough, you should definitely consider caching
the object once you create it. Use the Application Cache; it's thread-safe.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
L

Lowell Heddings

The problem won't be solved by using global variables. The problem is
that your treeview is way too big on the initial load.

Try using some of the treeview options that dynamically load data for
sub-nodes. The MSDN site, for instance, dynamically loads most of the
sub-nodes.

Lowell
 
G

Guest

So this means even if I create and populate the treeview variable in
Global.asa
, it'll still take a long time to load in a page?
 
L

Lowell Heddings

Do a right click and properties on the page... you'll probably find that
the page content is enormous, not to mention the javascript probably
required to build the thousands of treeview items.

Much better to load just the top 1 or 2 levels of the treeview, and then
dynamically load the rest.

Lowell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top