Sharing WebResources between Radwindows and Parent Page

4 posts, 0 answers
  1. Marc
    Marc avatar
    12 posts
    Member since:
    May 2008

    Posted 14 Apr 2009 Link to this post

    I created a Custom Portal Application that uses Windows Workflow on the back-end and Telerik Contols for the View. I use the RadWindow control for each Portlet (Module) and everything works beautifully, really excellent tools.

    Is there a way to share JavaScript (WebResouce.axd requests) between RadWindows(Iframes) and the Parent Page.
    Most of my RadWindows have some combination of a RadGrid, RadToolbar, RadTabStrip, and maybe some RadMaskTextBoxes and ComboBoxes.

    The reason I ask is because requests for the same scripts are being made for each Radwindow. Each RadWindow has its own copy of the Javascript.

    I have placed ScriptManagers on the MasterPage and on PortletWindow.aspx (which is my Portlet controller and the target of the RadWindow Controls).

    I realize that this is probably not possible, and things work great on a High speed connection but I thought I would ask since everytime a Portlet is added 200kb or so gets downloaded.

    This means that if the user has 6 Windows open in their Workspace Firebug is telling me that 1.2mb was downloaded.

    Thanks,
    Marc



  2. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 16 Apr 2009 Link to this post

    Hello Marc,

    We are glad to know that you find the products useful.
    The embedded scripts of the controls have unique IDs which allows them to be cached on the client side. So, if your browser cache is enabled (which is the default option)  the scripts files loaded in the parent page should be used from the cache when the child page in RadWindow loads.

    That said, in case you wish to combine the scripts of several controls into a single file and add this file manually to your page, you can do so as the scripts are distributed with the RadControls installation. The following Help article provides more information:
    http://www.telerik.com/help/aspnet-ajax/disabling_embedded_resources.html

    Greetings,
    Tervel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marc
    Marc avatar
    12 posts
    Member since:
    May 2008

    Posted 16 Apr 2009 Link to this post

    Tervel,
    Thanks for the response and verifying that cached scripts would be shared between parent and child windows. I also found http://www.telerik.com/help/aspnet-ajax/disabling_embedded_resources.html very useful offers a lot of transparency into whats being pulled.

    But if the WebResourse.axd Query string is different on my parent page or from RadWindow to Radwindow because they don't all use all the same controls will those scripts still be requested and not pulled from cache?

    Only when the WebResourse.axd Query string is exactly the same will the browser look in cache?

    For example my parent page has a Toolbar, Tabstrip, RadMenu, RadPanel, RadSplitter, RadWindowManager.
    And one of my Portlets(Radwindow) has a Toolbar, Radgrid, Calendar, Combobox, RadWindowManager.

    Do I want remove the RadScriptManager so that the Toolbar and Radwindow Scripts will only be requested once?
    Or do should I create a custom WebResource that bundles all of the scripts and so that the request looks the same accross the board?

    Thanks again,
    Marc
  5. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 17 Apr 2009 Link to this post

    Hi Marc,

    "Only when the WebResourse.axd Query string is exactly the same will the browser look in cache?"
    That is correct. The browser caching mechanism relies on the resource URL. When I wrote to you my original answer I was under the impression that you use the same set of controls on both pages.

    There are two things you might want to try
    1) You can disable the script combining capabilities of RadScriptManager - which will make the intial page load a bit slower, but then all scripts will be cached and when you load your RadWindow page they will be taken from the browser cache.

    2) Alternatively, as I originally suggested - you can combine the scripts of the controls which are used on both pages into a single file and add this file manually to your page, as the scripts are distributed with the RadControls installation.
    You will need to turn the embedded scripts for these controls off by setting EnableEmbeddedScripts = false.

    Best wishes,
    Tervel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top