I've been struggling for over 2 days trying various solutions and searching online, but I can't seem to get RegisterClientScriptInclude to function properly like everyone else.
For starters, I am using .NET 3.5 Ajax and incorporating javascript in my partial page refreshes with the following code:
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "MyClientCode", script, true);
It works flawlessly, as my javascript code stored in the script variable gets included in every partial refresh.
The javascript within script is quite extensive, so I decided to organize it in a .js file. Naturally, I created a .js file and attempted to include it using RegisterClientScriptInclude...but unfortunately, I cannot get it to work no matter what I try. Here's the exact code snippet:
ScriptManager.RegisterClientScriptInclude(this, typeof(Page), "mytestscript", "/js/testscript.js");
The testscript.js file only gets included in FULL page refreshes - when the page loads or during a full postback. However, I am unable to include the file in partial refreshes, and I'm puzzled by this issue. Even after inspecting the ajax POST in Firebug, I see no discernible difference whether the file is included or not.
Both ScriptManager Includes are executed from the same location in "Page_Load," so they should run during every partial refresh (but only the ScriptBlock does).
Any assistance, ideas, or additional troubleshooting tips would be greatly appreciated.
Thank you, Andrew