specify output cache settings in the codebehind???

A

alex

Ok there are two ways to specify output cache settings for the user
control.

1) using attributes

[PartialCaching(20)]
public class ctlMine : UserControl{}

2) and using @ OutputCache directive.

They both are "static". Now if I need to load a user control into
various pages and specify particular output caching settings per page,
how do I do this? What is the way to set it in the codebehind using
variables for cache duration, etc.

I can create a class:
System.Web.UI.PartialCachingAttribute cacheRules = new
System.Web.UI.PartialCachingAttribute(CacheDuration, null, null, null);
but how to I attach it to the control?

Thanks.
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top