How to call a javascript function inside server side after the code is executed in page load/any events ? I am using UpdatePanel in this page. I had tried Page.RegisterStartUpScript, ClientScript.RegisterStartupScript. None of this works.
How to call a javascript function inside server side after the code is executed
Share
With an UpdatePanel you need to use
ScriptManager.RegisterStartupScript, like this:You have to remember in an UpdatePanel, you’re not sending the whole page back to the client, so the
Pageversions won’t work, because their content never goes anywhere on a partial update. WithScriptManagerit actively shoves this into the AJAX response it’s sending as a script to execute, so it’s behaving a little differently.