Search code examples
javascriptasp.netjqueryajaxmodalpopup

Display modal after postback without ASP.NET Ajax


I have an ASP.NET button. When the button is clicked, I'd like a modal popup to display after the server-side code for the button runs. I don't want to use the ASP.NET Ajax control toolkit modal popup extender.

With ASP.NET Ajax, I can hook into the end request event. Is there a way to do this without ASP.NET Ajax. just jQuery? I basically want to run some javascript after the server side click code runs, after the postback.


Solution

  • It depends on what method you intend to use to start the postback via jQuery. If you're going to use an async postback (like jQuery.ajax), you can just provide a method to call when the postback is complete. See http://api.jquery.com/jQuery.ajax/.

    If you're just going to use the normal postback, you can use the Page.ClientScript.RegisterClientScriptBlock from your server-side method to register a script that will run after the postback completes.