I've tried to narrow the problem down to a simplest scenario and here it is:
1. Have a default.aspx with the following:
2. Default.aspx's code-behind:
3. This is MyControl.ascx:
4. MyControl.ascx's code-behind:
5. Here's the javascript (test.js):
Scenario that works:
Put the javascript on the .ascx itself then everything works; i.e., my break point in
AjaxManager_AjaxRequest() method gets hit.
Scenarios that does NOT work:
1. Seperate the javascript to its own .js file and specified its Build Action (in properties) to Embedded Resource
2. Add [assembly: WebResource("WebApplication1.test.js", "application/x-javascript")] to the AssemblyInfo.cs
3. Uncomment the 1st line in default.aspx's Page_Load method
I verified that the javascript function did get called but the break point in
AjaxManager_AjaxRequest() method never got hit.
Please help.