470,647 Members | 1,267 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

Control from Cache does not render values.

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
Nov 16 '07 #1
1 1134
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)
BizWorld wrote:
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
Nov 16 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Dennis M | last post: by
2 posts views Thread by John Lau | last post: by
2 posts views Thread by Welman Jordan | last post: by
reply views Thread by Bryce Budd | last post: by
15 posts views Thread by eladla | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.