Monday, March 26, 2012

Calling a JavaScript function after return from callback in UpdatePanel

Hi all.

I am trying to solve this focusing problem inherint in Atas, I have a 90% generic solution, but am missing the last piece to the puzzle.

I need a way to invoke a JavaScript function after the UpdatePanel has returned from a server callback.

I know this is pretty simple to do without an UpdatePanel, unfortunately I am kinda tied into the UpdatePanel.

Any help??

Thanks

Hi,

I had the same problem. This is the solution I could found.
See this post for reference:http://forums.asp.net/thread/1290506.aspx

function pageLoad()
{
$object("_PageRequestManager").propertyChanged.add(BindOnLoad);
}


function BindOnLoad(sender, args)
{

if (args.get_propertyName() == "inPostBack"){
if (!$object("_PageRequestManager").get_inPostBack()){
AtlasPostBack();}
}
}

function AtlasPostBack()
{ //Runs at every postback. This allows us to run things that need to be taken care of
//after postbacks

alert("partial postback is done");
}


Thanks,

I also found that from the server side, registering a script as a startup script will make it fire on every callback.

Page.ClientScript.RegisterStartupScript.

No comments:

Post a Comment