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

Javascript script combination

2 Answers 93 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
Mark Hubert
Top achievements
Rank 1
Mark Hubert asked on 20 Oct 2009, 06:44 AM
Hi,

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,
Mark

2 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 22 Oct 2009, 10:30 AM
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.

Greetings,
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.
0
Mark Hubert
Top achievements
Rank 1
answered on 30 Oct 2009, 03:34 PM
Thanks Tsvetomir,

The attached code helped me to achieve what I wanted.

Regards,
Mark
Tags
ScriptManager and StyleSheetManager
Asked by
Mark Hubert
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Mark Hubert
Top achievements
Rank 1
Share this question
or