This is a migrated thread and some comments may be shown as answers.

RadMenu and Caching

10 Answers 188 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Relative
Top achievements
Rank 1
Relative asked on 02 Oct 2008, 04:38 PM
Hi,

I have a radmenu in a user control which is loaded dyanamically from another user control. On first load of the site, i.e. after compilation, the menu operates correctly but on subsequent loads it does not an iisreset is needed for the menu to work again. This is due to me having output caching enabled (sql cache dependency). I get the sys is not defined/telerik not defined errors.

Remove the caching and everything is fine. I need to cache the menu / data as it is intensive to get the data. Anyone know what I need to do so I can set the output cache and the menu continue to work properly?

Thanks,

Leon.

10 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 03 Oct 2008, 07:24 AM
Hello Leon Mills,

This help topic explains how to configure RadMenu for output caching.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Relative
Top achievements
Rank 1
answered on 06 Oct 2008, 10:56 AM
For anyone reading this thread if you have menu control in a UC that is loaded dynamically my another UC you need to put the references in the the parent UC and the load all the script references from code.
0
MiroslavStantic
Top achievements
Rank 1
Iron
answered on 26 May 2009, 06:13 PM
For some reason, it only works the first time on my page. When the cached version is returned on subsequent requests, it does not expand the submenus (only root level items are visible, style is fine). Do I need some additional javascript references or startup code?
0
Andy
Top achievements
Rank 1
answered on 18 Dec 2010, 03:42 PM
Hi,

There is clearly an issue with the Telerik controls not working with Output caching enabled. The solution of registering
the CSS and JS manually - ie not through the axd is not a solution where the page also has other telerik contols on it. We gave up
on getting it working in favour of keeping the EnableScriptCombine="true" as there are so many scripts output unless this is not set.
Using Google PageSpeed you will see the difference between using the above setting or setting that to false.

Clearly Telerik need to address this issue - the best approach would be for the control to be aware that the Output cache is set
and that in that case for the scripts still to be included in the output of the page (assuming you have a .ascx control hosting whatever Telerik controls). Not many websites cache an entire page as usally there is dynamic content on the page dependant on whether or not a user has signed in.

The other method that we intend to check is to see if we can not get the "html" generated from the control and add this into a cache
E.g.
StringBuilder b = new StringBuilder();
HtmlTextWriter h = new HtmlTextWriter(new StringWriter(b));
this.LoadControl("~/control.ascx").RenderControl(h);
string controlAsString = b.ToString();
//Add controlAsString to the cache and cross your fingers. If this approach works that might mean we could get rid of using
the Output Cache on the control - I think this approach might work for some cases but not all.

Anyway the point is that Telerik really does not to address all the issues easily found using the PageSpeed tool as supplied to FireBug -
most of the issues are Telerik issues - i.e. the rendered output of the CSS from the axd is not stripped of spaces etc and therefore emits
more KB than is necessary - small point but there are many more complicated issues to be solved to so that Telerik controls are served to the client in the most efficient way possible.

Hope the above helps someone and I think Telerik should start really looking into this issue seriously - its fine for a page with a couple of controls
on it - of course it works - but in a real world application, where a page fragements should generally be cached while still only outputing one axd
I think Telerik is not testing this enough.

Regards,
Andy

0
Simon
Telerik team
answered on 22 Dec 2010, 06:11 PM
Hi Leon Mills,

We have researched ways of detecting whether Cache is enabled without finding any. Additionally once the page is cached, there will be nothing that could serve the scripts for new controls, we will be unable to load their scripts. These are the two reasons we did not implemented this feature before.

All the best,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Relative
Top achievements
Rank 1
answered on 22 Dec 2010, 06:25 PM
Simon,

I haven't written on this thread for over 2 years.........

L.
0
Simon
Telerik team
answered on 22 Dec 2010, 08:02 PM
Hello Leon Mills,

Yes, actually my response was directed to Andy.

Please both excuse me for my mistake.

Kind regards,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Andy
Top achievements
Rank 1
answered on 06 Jan 2011, 04:29 PM
Hi Leon

Hope you have had a good new year. Could you not detect the header information to understand if the page is cached or not?
I fully understand the difficulty of fixing this issue but I am sure you team could resolve this - if you know the header information
in the HTTP pipeline then you could emit the js and css and each request but keep the html cached? Just a thought.

Cheers
Andy
0
Relative
Top achievements
Rank 1
answered on 06 Jan 2011, 04:31 PM
Hi,

i am not the person who has resurected this thread after two years, see earlier posts!

L.
0
Simon
Telerik team
answered on 07 Jan 2011, 05:59 PM
Hi Andy,

We have researched ways of detecting whether a page has caching enabled without success. Even if there is a way the life cycle of our controls do not execute because of the caching and we will be unable to register their scripts/style sheets again. In other words how would we register these resources even if we detect whether the request is cached?

Perhaps implementing a custom output cache provider will allow you to overcome the whole issue in your environment.

Kind regards,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Menu
Asked by
Relative
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Relative
Top achievements
Rank 1
MiroslavStantic
Top achievements
Rank 1
Iron
Andy
Top achievements
Rank 1
Simon
Telerik team
Share this question
or