RegisterClientScriptInclude doesn't work for some reason...

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-03-24T16:33:53Z Indexed on 2010/06/17 4:03 UTC
Read the original article Hit count: 288

Filed under:
|
|
|

Hey,

I've spent at least 2 days trying anything and googling this...but for some reason I can't get RegisterClientScriptInclude to work the way everyone else has it working?

First off, I am usting .NET 3.5 Ajax,...and I am including javascript in my partial page refreshes...using this code:

ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "MyClientCode", script, true);

It works perfectly, my javascript code contained in the script variable is included every partial refresh.

The javascript in script is actually quite extensive though, and I would like to store it in a .js file,..so logically I make a .js file and try to include it using RegisterClientScriptInclude ...however i can't for the life of my get this to work. here's the exact code:

ScriptManager.RegisterClientScriptInclude(this, typeof(Page), "mytestscript", "/js/testscript.js");

the testscript.js file is only included in FULL page refreshes...ie. when I load the page, or do a full postback....i can't get the file to be included in partial refreshes...have no idea why..when viewing the ajax POST in firebug I don't see a difference whether I include the file or not....

both of the ScriptManager Includes are being ran from the exact same place in "Page_Load"...so they should execute every partial refresh (but only the ScriptBlock does).

anyways,..any help or ideas,..or further ways I can trouble shoot this problem, would be appreciated.

Thanks, Andrew

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript