Control from Cache does not render values.

B

BizWorld

I am trying to cache a full DROP Down that can have lot of values. so
i have 500 site users hitting a page in a second. i need to cache some
controls that does not change quite often during the day. i am trying
to test HTTRuntime.Cache object. in debug mode i can see the values on
server side after i get the drop down from the cache but some how it
does not show the values on generated html page. any idea what i am
missing???


If System.Web.HttpRuntime.Cache("DropDownList1") Is Nothing Then
DropDownList1.Items.Add("1")
DropDownList1.Items.Add("2")
DropDownList1.Items.Add("3")
System.Web.HttpRuntime.Cache("DropDownList1") =
DropDownList1
Else
DropDownList1 =
CType(System.Web.HttpRuntime.Cache("DropDownList1"), DropDownList)
Response.Write(DropDownList1.Items.Count.ToString)
End If
 
B

bruce barker

you can not cache controls in session. this will lead to huge memory
leaks, along with unexpected behavior.

cache the data used to load the list.

-- bruce (sqlwork.com)
 

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,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top