Starting with Q1 2013 RadScriptManager has the ability to combine external scripts (specified only by path) through the Telerik.Web.UI.WebResource.axd handler. Since this operation requires access to the project file structure, a 'safe' folder or a list of folders must be specified in the web.config file of the web application/site.
You can specify one or more folders from your project that host the external scripts.
The folder paths must be relative to the root of the application. For example,
Add the following
<appSetting /> entry in your web.config:
<appsettings> <add key="Telerik.Web.UI.ScriptsFolder" value="~/Scripts/;"/> </appsettings>
This will include subfolders of the
~/scripts folder as well, so you do not need to define them explicitly.
If you want to add several folders that are not nested within one another, add them in a single
<appsettings> <add key="Telerik.Web.UI.ScriptsFolder" value="~/Scripts/;~/MoreScripts;~/Assets" /> </appsettings>
Register the external scripts in RadScriptManager. The paths to the files can be relative to the root or to the folder containing the current page.
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> <Scripts> <telerik:RadScriptReference Path="../Script1.js" /> <telerik:RadScriptReference Path="~/Scripts/Script2.js" /> </Scripts> </telerik:RadScriptManager>
If a references external script is not in one of the folder designated in the configuration, it will be not be combined and will be served separately.
You can specify more than one script folder. Separate folders with a semicolon
If you specify a querystring (for example, to create a cache buster), the file will not be combined with the rest of the resources.
- The primary purpose of the control is to serve scripts from assemblies, and when the assembly build changes, the URL generated by RadScriptManager will also change and it will contain the new scripts. A built-in cache buster is not implemented in RadScriptManager for script files.