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

RadScriptManage and custom JS

1 Answer 39 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 13 Nov 2008, 09:09 AM
Hi, this is nearly the same as my presious post about the RadStyleSheetManager, but I've been reading the RadScriptManager tutorial, and again I'm not sure how I can use it. Just puting the RSM on the page is enough to combine all the call to JS-files?

Or do I have to use
<telerik:RadScriptManager id=””runat=””> 
 <Scripts> 
  <asp:ScriptReference name=””Assembly=””Path=”/MyVirtualLocation/MyFile.js”> 
 </Scripts> 
</telerik:RadScriptManager> 
 

to reference the custom-scripts.

Is it also possible to put the script in a custome class (like suggested for the RadStyleSheetManager) to be included in a single request.

I use the RSM on my masterpage, but I still see three script-tags in my html-output instead of one. So I would conclude the scripts are not embedded resources. But if I use the code above, and reference the correct path, it should combine, but then the  scripts are still not embedded.

Hope it is clear to you what I'm trying to ask.

Thanks for the reply


1 Answer, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 14 Nov 2008, 10:25 AM
Hi Stephan,

RadScriptManager currently combines only scripts that are embedded resources to an assembly. If a ScriptReference has its Path property defined, it is automatically excluded from the combination and the combined script tag gets split (in order to keep possible references).

You could use the RadStyleSheetManager approach to have the scripts combined though - embedding them in an assembly and registering them as ScriptReferences would do the job just perfectly. By the way, if you have an IScriptControl, which registers itsef to the ScriptManager (similar to the controls in the AjaxControlToolkit), RadScriptManager will include its scripts automatically to the combination.

Kind regards,
Erjan Gavalji
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Stephan
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Share this question
or