Prevent user control caching. Master/Details.

H

helveticus

I have a master/details configuration that includes multiple user
controls. The details page is configured to cache data via
VaryByCustom. This works fine.

One of the user controls contains an image button. With caching turned
on, the control remains "lame" since the control is only dynamically
generated during the first access.

My understanding is that page caching directive causes all page user
controls to be implicitly cached as well. To prevent user control
caching, I tried adding the following code inside the user control
load event. But this clears the whole page cache:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
If Not Page.IsPostBack Then
Response.Cache.SetCacheability(HttpCacheability.NoCache)
End If
End Sub

Is is possible to exclude a specific user control from being cached
when the page is cached? Are there other alternatives? TIA for any
hints.
 

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,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top