Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Closed Issue: ClientScriptResource with null as componentType sometimes throws an error [20532]

$
0
0
Hi,

I'm using the ClientScriptResource attribute to include additional JavaScript files in my custom extender control. To do this, I pass null as componentType, just like the documentation (http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Walkthrough/ExtenderClasses.aspx) says:

[ClientScriptResource("MyControls.Component1", "Webresource.Name.Of.Script1.js")]
[ClientScriptResource(null, "Webresource.Name.Of.Script2.js")]


Most of the time this works great, but sometimes this triggers an exception:

Value cannot be null or empty. Parameter name: type

at System.Web.UI.ScriptComponentDescriptor..ctor(String type)
at System.Web.UI.ScriptComponentDescriptor..ctor(String type, String elementID)
at System.Web.UI.ScriptBehaviorDescriptor..ctor(String type, String elementID)
at AjaxControlToolkit.ExtenderControlBase.GetScriptDescriptors(Control targetControl) in C:\Path\To\ExtenderControlBase.cs:line 420
at System.Web.UI.ExtenderControl.System.Web.UI.IExtenderControl.GetScriptDescriptors(Control targetControl)
at System.Web.UI.ScriptControlManager.RegisterScriptDescriptors(IExtenderControl extenderControl)
at System.Web.UI.ScriptManager.RegisterScriptDescriptors(IExtenderControl extenderControl)...

This error only occurs occasionally and is solved by swapping the 2 clientScriptResource attribute declarations. Then, after some time, the error occurs again and is solved by swapping the 2 attribute declarations back (I guess because this triggers a new compilation of the code).

I tried using the RequiredScript attribute, but there is no way to include a script based on its resource path (I thought this could be accomplished by using the scriptName property of the attribute, but this property doesn't seem to be used within the ACT).


Thomas

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>