RadRotator with Output Caching

3 posts, 0 answers
  1. Imran
    Imran avatar
    24 posts
    Member since:
    Jan 2007

    Posted 22 Dec 2008 Link to this post

    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. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 29 Dec 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Imran
    Imran avatar
    24 posts
    Member since:
    Jan 2007

    Posted 07 Jan 2009 Link to this post

    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.
Back to Top