Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

ScriptResource.axd Loaded By One Custom Control and Unloaded by Another?

$
0
0

I have a server control library for my companies internal website.  I have two controls.  The first is a date control which registers the following javascript resources from the library: jQuery, jQueryUI, jQuery Migrate, and TimePicker plug-in.  The second control is a spinner control which registers the three jQuery javascript resources from the Date control.  I am doing this because there is no guarantee that any control will be with another on the same page.  Besides, the RegisterClientScriptResource method should not load the same resources multiple times as long as the ID is the same.  I test the control library with 1, 2 and 3 Date controls on the same page, it worked fine.  I test a page with just the Spinner control, it worked fine.  As soon as I placed a Date and Spinner on the same page it no longer seems to recognize the TimePicker plug-in resource as being registered.  I verified that the order in which the controls appear on the page matters.  The page only seems to be registering the resources for the last control on the page. Here is how I am loading the scripts in each control's OnInit method:

ScriptManager.RegisterClientScriptResource(MyWebpage, MyControlType, ResourceName)

I have checked the IE and Chrome debugging tools and verified that the ScriptResource.axd is no longer registered for the TimePicker plug-in despite putting a break point on that line of code and verifying that it was executed.  Can anyone explain why the RegisterClientScriptResource method appears to only load the resources from the last control on the page?

NOTE: Changing to Page.ClientScript.RegisterClientScriptResource does not change the outcome.

Thanks


Viewing all articles
Browse latest Browse all 5678

Trending Articles