Run javascript after form submission in update panel?

人走茶凉 提交于 2019-12-04 10:46:39

To register from the Codebehind, here's the format:

ClientScript.RegisterStartupScript(GetType(), "AutoPostBackScript", 
                                   "alert('hi');", True);

The true on the end tells it to wrap your code in <script> tags, leave it off if you want to do the tags yourself.

You may checkout the endRequest event:

function pageLoad() {
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(sender, e) {
        // this function will be executed after the update panel finished 
        // the AJAX request, so here you may open your jQuery dialog

        if (e.get_error()) {

        } else {

        }
    });
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!