Click here to Skip to main content
15,888,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a dropdown in a website and my website has a dropdown and this drop down is data binded from database. Now I want the dropdown data to be cached so that when I go to next page and come back to this page it should not hit the database. please give some points on this.
Posted
Updated 10-Oct-11 1:12am
v2
Comments
dreamz9 10-Oct-11 6:32am    
Please explain in detail..

Hi,
A generic loading of data in a DropDownList using caching mechanism[^]
i hope the above link will help you
thanks
Venkatesh Gudipati
 
Share this answer
 
In addition, you might try below,

1) Create a Class for example, DDLCache which will hold the initial value for the DDL, retrieved from the Db.
2) Store the object(which contains all the values retrieved from Db ) of type DDLCache into the Session.
3) So then you just need to check if the object of DDLCache stored into Session is null or empty, otherwise read from the Db.

More details about Session[^].

Hope it helps :)
 
Share this answer
 
 
Share this answer
 
Simple when you are binding the dropdown then store your datga source to cache and before binding check the cache is null or empty
if null or empty then fetch from db else
read from cache.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900