• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

Cache dropdownlist

How do I cache dropdownlists? For example, I have a "state" table that doesnt change. I bind it to the ddl once. But next time i load the page, i dont want to go back to the database again...

I think i need to use cache["whatever"] but i dont need for example, to cache for a month something...
0
Camillia
Asked:
Camillia
2 Solutions
 
Daniel Van Der WerkenIndependent ConsultantCommented:
There are multiple mechanisms for saving out state for a page in ASP .NET.

Here is an article on how this is done.
http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx

I would say use ViewState["whatever"] = theObject;
0
 
CamilliaAuthor Commented:
viewstate? then if i close the page, open it again, it will go to the database again. State info is something that won't change that often...
let me look at the link
0
 
CamilliaAuthor Commented:
that link doesnt mention cache.. i need to cache for like a month..i know i've used it before but cant find a sample code
0
 
nakuluCommented:
This might help:

How to: Add Items to the Cache
http://msdn.microsoft.com/en-us/library/18c1wd61.aspx#Y114

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now