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

[Solved] Setting RadScriptManager.ScriptPath + EnableScriptCombine="false" causes error

1 Answer 190 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
stoneym
Top achievements
Rank 1
stoneym asked on 02 Apr 2009, 04:06 PM
In the course of my development I needed to have access to the Microsoft Ajax JavaScript.  To achieve this I set the ScriptPath property of the RadScriptManager to a folder on my site.  This requires having all of the JavaScript files available from Microsoft, Telerik, and the AjaxControl Toolkit for my website.  I have all of those scripts in the correct folder structure and they are all available and the browser loads them fine.

When running the app this way with EnableScriptCombine=false the RadAjaxManager is trying to load some of the scripts twice.  In the _onFormSubmitCompleted event of RadAjaxControl it builds an array of script files from the response stream.  It then checks to see that it wasn't from an axd (this is why EnableScriptCombine=false works when not setting ScriptPath), and if it is not it calls the IncludeClientScript method on it which tries to eval it which causes it to blow up because the script has already been loaded by the browser.  So it throws a Sys.Res.typeRegisteredTwice error on whatever objects are in the script.

I am assuming that the RadAjaxControl does this because javascript could be dynamically included during postback by one of the Telerik controls.  It needs to distinguish between this javascript and the javascript that has been included by setting the ScriptPath property and exclude those scripts that come from the ScriptPath from this processing.

Anyone else run into this, and is this your take?

Thanks,
Stoney

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 03 Apr 2009, 12:35 PM
Hi stoneym,

I'm afraid that the behavior in question is limitation in current implementation of RadAjax. Unfortunately there is not easy way of determine if the scripts are already loaded  and to skip their explicit loading on ajax request. Thus I suggest you if it is appropriate in your scenario to use ScriptManager's scripts collection (shown in this help article) as this way scripts will be served through the script http handler, or if this is not appropriate to use update panels instead.

Greetings,
Rosen
the Telerik team

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