Problems caching user contorl on page

M

moondaddy

My default page stays constant in the site and all the content in the body
of the page is produced with user controls in a table cell for the body
section. The main function of this site is a products catalogue and the
products show in a datagrid in one of the user controls. This datagrid has
many rows and columns of images and this is what I'm most interested in
caching.

If I put
<%@ OutputCache Duration="500" VaryByParam="MenuID" Location="Client" %>
in the top of the ProductsListing user control then the default page gets
cached and when I click on a menu which should repopulate the datagird, it
shows the home page user control instead. I figured that putting this tag
on the user control just confused things, to the I put in on the top of the
default page and things behaved as though nothing was being cached. The
"MenuID" param is what gets passed into the default page where in the code
behind gets passed to the user control to populate the grid according to the
menu ID.

Can anyone offer some help on how to cache different versions of a user
control according to the param value?
 
S

Steven Cheng[MSFT]

Hi Moondaddy,

From your description, you used some certain UserControls on a certain web
page. And you use Caching on those UserControls but found it not work as
expected, yes?

It seems that your page strucutre is abit complex. Would you create a
simple page and use few UserControls on it and test whether this problem
can be repro. Also, it'll be most helpful if you can provide some demo
code on this issue.

In addition ,here are some related reference in MSDN:

#Caching Multiple Versions of a User Control Based on Parameters
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcachingmultiplever
sionsofusercontrolbasedonparameters.asp?frame=true

#Caching Multiple Versions of a User Control by Using Declarative Attributes
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcachingmultiplever
sionsofusercontrolusingdeclarativeattributes.asp?frame=true

Hope this will help you. Also, if you have any new findings, please feel
free to post here. Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top