where to put load of static data?

G

Guest

Hi,

I am wondering where in my ASP.NET application to load a dropdown list box
that
basically only changes once a year.

I load a drop down list box with about 40 locations. If it never changes
should I put it in the page load event of the page?

Could I not put the loading of the dataset into the applicaton start event? or
cache it on server in some way? Each time a new user visits the page and
before it has been added to view state, it accesses the database. I'd like to
minimized access to the database for something that never changes.

thanks

Chris
 
M

Mr Newbie

One way is to create an XML file with your locations in and store it in the
local directory of your project. You can use the page_laod event to load
this into a dataset and then bind the DropDown to the dataset, this way when
you want to change the locations, you need only change the XML file.
 
R

rviray

I would do what Mr Newbie said and put it in an XML file...but to g
further, I would then load it into Server Cache (for a little bi
faster performance) with a Dependency on that XML file...so that whe
your list changes (next year...possibly), the Cache will update base
on the change
 
G

Guest

thanks for responses.

The locations are coming from data table that is used extensively by other
websites and applications.

I also created a data relations (child parent) using 2 fields in the
locations table.
I would have to manually create the XML with the Relations created manually.

Later I can write a tiny application that exports the list of locations
using the datarelation to an XML file.

On further thought I think I will stay with the database load for now and use
server caching to speed things up a bit.

thanks for replies.

Chris
 

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,048
Latest member
verona

Latest Threads

Top