> in the page_load event, populate your dropdown list when it isn't a postback
> and don't when it's not. ViewState will take care of persisting the list
> values for you. You don't need to do anything.
I'm sorry if I wasn't clear. Currently, all dropdown controls for a
given page are loaded only once during the initial page load. What I
would like hear about are ways developers are sharing those dropdown
values globally between all users without having to run the query
against the db each time a page is accessed. Are there any approaches
being used that prevent having to access the database each time a page
is loaded to get the dropdown list values?
Scott M. - 25 Nov 2004 14:45 GMT
In the Global.asax file, you could go to your database in the
Application_Start event handler and fetch the values. They could then be
stored in a Public Shared String array. In the Page_Load event of the page
in question, you could load up the dropdown from the values in the array.
>> in the page_load event, populate your dropdown list when it isn't a
>> postback
[quoted text clipped - 8 lines]
> being used that prevent having to access the database each time a page
> is loaded to get the dropdown list values?
Ben Strackany - 29 Nov 2004 19:15 GMT
I'd suggest caching the dropdown. Two ways you could do it:
1. You could cache the database results. Use the Cache object to store the
DataSet/etc. that you load from the database. If the cache expires (for
whatever reason) you can re-populate the Cache by calling the database
again.
2. Or, you could cache the actual HTML of the dropdown. Create a user
control that contains the dropdown, and use partial-page output caching (or
fragment caching) to cache the HTML of that user control. That user control
will only call the database when it's created, & not while it's cached.
#1 might be a little easier to get started with, but #2 might give you
better performance in certain situations. Either approach is straightforward
enough. Check MSDN, GotDot net, ASP.NET QuickStart
(http://samples.gotdotnet.com/quickstart/aspplus/), or google for more
information on how to use caching. Good luck!

Signature
Ben Strackany
www.developmentnow.com
<a href="http://www.developmentnow.com">dn</a>
> > in the page_load event, populate your dropdown list when it isn't a postback
> > and don't when it's not. ViewState will take care of persisting the list
[quoted text clipped - 7 lines]
> being used that prevent having to access the database each time a page
> is loaded to get the dropdown list values?
Mujahid.Net - 15 Feb 2005 10:43 GMT
You can use DataSet save methid to store db retrived data into an xml file
and populate the List from local XML dataset file! This can be used
irrespective of the session.
> > in the page_load event, populate your dropdown list when it isn't a postback
> > and don't when it's not. ViewState will take care of persisting the list
[quoted text clipped - 7 lines]
> being used that prevent having to access the database each time a page
> is loaded to get the dropdown list values?