User Control Caching

J

Joe Fallon

I have a simple user control that I use for the footer of each page.
It has one line of text with things link comapny name and a few hyperlinks
to jump to other pages.

If I want to use partial page caching I could assign this directive to it:

<%@ OutputCache Duration="60" VaryByParam="none" %>

Then as each page renders it should pull the already rendered footer from
cache instead of re-generating it.

My question is:
What if I want to hide some of the links on certain pages? e.g. a Popup page
should not have links on it.
So for those pages I want the footer to be different.

I currently have code in the user control to handle this. But that means I
generate the control for each page.

I would like to know how to cache the user control for both types of
windows - normal and popup.
Obviously, I could build another user control so I could assign the right
one to each window type.
But I am looking for a way to do it with 1 control.

Thanks!
 
S

Scott Allen

Hi Joe:

Is there a GET or POST parameter that tells the user control how to
build differently? You could set VaryByParam to that parameter name.

If that doesn't work, there is always VaryByControl, and VaryByCustom
when nothing else will do.
 

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

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top