Monday, March 26, 2012

Executing custom client script after an UpdatePanel callback. How to do it?

I have a series of update panels doing their dance, andafter they are done, I'd like to execute a custom javascript function on theclient. I tried to add a separate update panel with a literal as a placeholderfor a javascript injection and set some code in the literals text property likethis:

protected void CallBackEventMethod()
{
javascriptInjectionLiteral.Text = @dotnet.itags.org."<scriptlanguage='javascript'>alert('waz up');</script>";
}

Woe is me, this does not work. Can anyone point me in the right direction as tohow I would execute client side logic after a server callback which is firedfrom an update panel?

Thanks,

bd

hello.

just add your script to the page by calling one of the registerXXX methods of the clientscriptmanager class.


yes but how do I then _call_ the script when the callback has completed it's processing?

In other words, how do I call the client side method once the CallBack has completed its processing?

bd
ok I see, RegisterStartupScript will call that method on the return of a CallBack as well as a postaback.

sweet

thanks for your help Luis,

bd

No comments:

Post a Comment