Wednesday, March 28, 2012

Page.RegisterClientScriptBlock breaks Ajax?

Hi -

I am using

Page.RegisterClientScriptBlock to write a script dynamically to my webpage. For some reason, this seems to break some of my other java script (don't get called at all).

I'd be grateful for any idea experience with this!!! Thanks!!!!

Oliver

You want to use the ScriptManager version of that same method instead, the Page's version doesn't work withthe ajax framework.


Paul -

thanks so much. This was quite useful. May I ask you a follow-up question? While Ajax now works on the page, one additional control that loads its Javascript from a file still doesn't ... is there anything special I need to consider?

Thanks again,

Oliver


Well, if that control doesn't load the file through the scriptmanager, that'll be a problem for you as well. What's the control? Also, any .js files need to have a line at the end of them:

if(Sys && Sys.Application)
Sys.Application.notifyScriptLoaded();

No comments:

Post a Comment