Javascript script combination

3 posts, 1 answers
  1. Mark Hubert
    Mark Hubert avatar
    6 posts
    Member since:
    Apr 2007

    Posted 20 Oct 2009 Link to this post


    I have a website where via the menu (based on RadTabStrip) a number of pages can be accesses which all have one or more telerik components in them. E.g. Radcomboboxes, grids, etc.

    For script combination, the RadScriptManager is included in the masterpage.

    The webresource.axd file for all separate pages is pretty big, but different for every page.

    What I would like to do is include all the javascript for all the used telerik controls in the masterpage.
    This way, the generated webresource.axd file is slightly bigger initially, but will be used from cache on any subsequent page access.

    So, I am wondering, is there an easy way to do this?
    In the documentation I have found that when UseEmbeddedResource is disabled for the controls, the javascript can be included manually. However, the RadScriptManager can not combine them this way because they are not embedded as resources.
    I guess I can include all those javascript files in a dll as embedded resources, however, I am a bit reluctant to do this since this must be done then for every new release.

    Has anybody advise on the direction to go with this?

    Best Regards,

  2. Answer
    T. Tsonev
    T. Tsonev avatar
    2831 posts

    Posted 22 Oct 2009 Link to this post

    Hello Mark,

    Indeed combining all of the scripts up front can be a great strategy. We have some ideas on how to make this easier in the future versions, but for the moment this has to be done manually. We have a tool that can list all of the loaded scripts on the page in the correct order.

    Open the attached web site and place all the controls that you intent to use in the ScriptResourceDetector.aspx page. Run it and you'll get a list of the ScriptReferences that you need to include in your RadScriptManager.

    Keep in mind that upgrades to later versions will require an update to the scripts as well.

    I hope this helps.

    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Mark Hubert
    Mark Hubert avatar
    6 posts
    Member since:
    Apr 2007

    Posted 30 Oct 2009 Link to this post

    Thanks Tsvetomir,

    The attached code helped me to achieve what I wanted.

Back to Top