Common methods / best practices

D

dwight0

I have an ASP.net application where most pages have the same dropdown
menu with a list of usernames to select from. The dropdown menu is
filled from a cache as long as the cache hasnt expired and if the cache
has expired after 15 minutes, the cache object gets filled again from a
database. I do this just to keep the list up to date but also to keep
the database from being queried several times a second. Currently i
just pasted the code for do this on every page. Where/how would be the
best central place to put this in ASP.net? I was thinking of making a
static class to do this and i put a single line on each page to call a
method in that static class. Also as an alternative, I wondered if it
was possible and a good idea to make another page thats only purpose is
to update this and some other cache objects. Could i use Server.Execute
call this page, to fill the variables? I would prefer to keep it as a
page isntead of a static class because it makes it easier for others
who use the VS IDE (instead of write the code by hand) to easily
manipluate the controls / properties on the page in the case i wasnt
available to work on the project.
 
K

Karl Seguin

why not just place the dropdown list inside a user control which can be
shared amongst all pages....
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top