tags:

views:

1553

answers:

2

I'm looking for something like OnClientClick for a button, but I want it to happen after the postback (instead of before). I'm currently using the following, which works, but it adds the script block over and over again, which is not what I want. I simply want to execute an existing client script function.

ScriptManager.RegisterClientScriptBlock( 
  this, 
  typeof( MyList ), 
  "blah", 
  "DraggifyLists();", 
  true );
A: 

If you're using ASP.NET AJAX, you could try the following:

addRequestHandler() must be called when your page loads

function addRequestHandler()
{
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
}


function endRequestHandler(sender, args)
{
    // This function will be called after the postback has completed

    // add your JavaScript function call here
}

This is based on code from Disturbed Budda

Richard Ev