Dear Asif,
In the UserControl, Put the following code in the top next to the "@ Control Directive" line,
<%@ OutputCache Duration="10" VaryByParam="None" %>
The above code would make the usercontrol being cached every 10 seconds.
Hope it helps
> Hello
> I have a User Control which i used on each page of whole webapplication. i
> want to cache that control so that web application become speedy.
> I am new to implement asp.net Cache Facility. Kindly help me to carry out
> this task. Thanks
Malik Asif Joyia - 02 Jul 2004 11:40 GMT
Hello
When I cache a Header Control in which I have page header images. And a link
button control. Which I use to logoff the user. But when I implement the
Cache . Writing line to header control file .ascx
<%@ OutputCache Duration="120" VaryByParam="none" VaryByCustom="Browser"
Shared="true" %>
But After Implementing this page Give a Java Script Error "Object Not
Found"..this is the error in code generated for linkbutton control.
Thanks
> Dear Asif,
>
[quoted text clipped - 11 lines]
> > I am new to implement asp.net Cache Facility. Kindly help me to carry out
> > this task. Thanks
Mr. Dot Net - 07 Jul 2004 10:50 GMT
I guess that's because you're registering javascript to the page in the user
control's code.
something like this:
uc.Page.RegisterScriptBlock etc...
Since the control is loaded from cache there is no way that the code will
loaded as well since it's in a different container: the page instead of the
user control.
One way to solve this is put the script block inside the user control's
container.