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

RadRotator with Output Caching

2 Answers 107 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Imran
Top achievements
Rank 1
Imran asked on 22 Dec 2008, 02:20 PM
Hello

I have a user control that has a RadRotator. On the user control, I have SQL OutputCache Dependancy. When I put one instance of my control on the page with caching, everything works as expected.

When my page has two of those controls with caching, when the page is first rendered, everything is fine. If i refresh the page and page is created from cache, I get the following javascript error:

Error: 'Telerik' is undefined
Line 661

<script type="text/javascript">

//<![CDATA[

Sys.Application.add_init(

function() {
 

Line661:

$create(Telerik.Web.UI.RadRotator, {

"clientStateFieldID":"ctl00_ContentPlaceHolder1_ctl01_WrapperUpcoming1_UpcomingWork_WorkImagesRepeater_ClientState","controlButtons":{"UpButtonID":"","DownButtonID":"","LeftButtonID":"ctl00_ContentPlaceHolder1_ctl01_WrapperUpcoming1_UpcomingWork_ImgLeft","RightButtonID":"ctl00_ContentPlaceHolder1_ctl01_WrapperUpcoming1_UpcomingWork_ImgRight","OnClientButtonClick":"","OnClientButtonOver":"","OnClientButtonOut":""},"frameDuration":0,"items":[{},{},{},{},{},{},{},{},{},{},{},{},{},{}],"rotatorType":2,"scrollDirection":1,"skin":"Default"}, null, null, $get("ctl00_ContentPlaceHolder1_ctl01_WrapperUpcoming1_UpcomingWork_WorkImagesRepeater"));

});

Sys.Application.add_init(

function() {

$create(Telerik.Web.UI.RadRotator, {

"clientStateFieldID":"ctl00_ContentPlaceHolder1_ctl01_WrapperNewReleases1_NewWork_WorkImagesRepeater_ClientState","controlButtons":{"UpButtonID":"","DownButtonID":"","LeftButtonID":"ctl00_ContentPlaceHolder1_ctl01_WrapperNewReleases1_NewWork_ImgLeft","RightButtonID":"ctl00_ContentPlaceHolder1_ctl01_WrapperNewReleases1_NewWork_ImgRight","OnClientButtonClick":"","OnClientButtonOver":"","OnClientButtonOut":""},"frameDuration":0,"items":[{}],"rotatorType":6,"scrollDirection":1,"skin":"Default"}, null, null, $get("ctl00_ContentPlaceHolder1_ctl01_WrapperNewReleases1_NewWork_WorkImagesRepeater"));

});

Sys.Application.initialize();

//]]>

 
</script>

If you can offer any assistance with this, it would be greatly apprecaited. Thanks
 

 

 

2 Answers, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 29 Dec 2008, 03:33 PM
Hello Imran,

The ASP.NET Caching mechanism is not as advanced as it should - or rather, it is fine, but it goes into a conflict with the controls' attempt to render XHTML-compliant code on the page.

By default, Telerik RadControls, as well as other "well-behaved" controls would try to register their CSS (<link>) tags and code (<script>) tags in the <head> element of the page. Unfortunately, this is ignored by the ASP.NET Cachign mechanism - on subsequent calls it fails to determine this behavior and on subsequent requests simply "spits" out only what was rendered by control between its opening and closing tags.


The following help article discusses how to register a particular control skin manually
http://www.telerik.com/help/aspnet-ajax/skinregistration.html






The following article provides clues which scripts should be manually registered for which control, if its own scripts are disabled by setting EnableEmbeddedScripts = false (or chossing to cache a control)
http://www.telerik.com/help/aspnet-ajax/disabling_embedded_resources.html

Once you are able to register manually (on your main page) and get scripts and css for a control running - then the user control it is in should work fine with caching enabled.


Kind regards,
Tervel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Imran
Top achievements
Rank 1
answered on 07 Jan 2009, 11:47 AM
Tervel

many thanks for your reply. I've decided that instead of caching the user control, i will cache the datasource that I bind the control too.
Tags
Rotator
Asked by
Imran
Top achievements
Rank 1
Answers by
Tervel
Telerik team
Imran
Top achievements
Rank 1
Share this question
or