The specific code example that you describe does not work with partial post-feedbacks, because ClientScript.RegisterStartupScript() writes JS to the page during the build phase of the request life cycle output; whereas partial postback only updates the selected part of the page using JavaScript (even if markup is created on the server for the entire page, including your script run).
In order to accurately match what you are describing, you must include the Literal control inside your UpdatePanel, and during the partial postback, set the Text property in the content pane to the script you want to run:
myLiteral.Text = "<script type=\"JavaScript\">doStuff();</script>";
IMO, the more correct way is to use the client API for asynchronous postbacks to register an event handler that will execute after the postback
function endRequestHandler(sender, args) { doStuff(); } Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
If you need to pass information that was created during the postback to the handler, you can pass it through hidden fields and capture it from the DOM in your client-side handler.
Rex m
source share