admin管理员组文章数量:1332359
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.
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.
Share Improve this question asked Aug 16, 2010 at 15:24 SteveSteve 5,95212 gold badges55 silver badges76 bronze badges2 Answers
Reset to default 5You can use ScriptManager.RegisterStartupScript()
for this, something like this:
ScriptManager.RegisterStartupScript(MyUpdatePanel, GetType(), "post-load-script",
"$(function() { $('#dialog').dialog(); });", true);
Then the request from the UpdatePanel es back it would be running this:
$(function() {
$('#dialog').dialog();
});
You could of course put anything you wanted for script there, but if you simply used a Label or whatever in the #dialog
<div>
that populated as part of the update, this would show it (if you're using the jQuery UI dialog, there are others). The concept is very general, you're just registering some JavaScript to run when the async request es back, which modal and how you want to do that is very open.
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 plete. See http://api.jquery./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 pletes.
本文标签: javascriptDisplay modal after postback without ASPNET AjaxStack Overflow
版权声明:本文标题:javascript - Display modal after postback without ASP.NET Ajax - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742317108a2452038.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论