简体   繁体   English

如何使用JavaScript停止ASP.NET上正在进行的回发(长时间执行)?

[英]How to stop ongoing postback (long running execution) on asp.net using javascript?

aspx web page and I am submitting some filter text to page to load the data using javascript and displaying progress till the result returned, but in some case when the execution takes long time to return the result user should be able to cancel the ongoing execution on server and progress should be removed. aspx网页,我正在向页面提交一些过滤器文本以使用javascript加载数据并显示进度,直到返回结果为止,但在某些情况下,如果执行需要很长时间才能返回结果,则用户应该可以取消正在进行的执行服务器和进度应删除。

I have hide the progress bar on click of html button, but how I can stop the on going execution on server so it don't return the result or the returned result don't get rendered later on. 我已经在单击html按钮时隐藏了进度条,但是我如何在服务器上停止正在进行的执行,因此它不返回结果或返回的结果以后不再呈现。

is there a way to stop on going postback on asp.net using JavaScript ? 有没有一种方法可以停止使用JavaScript在asp.net上进行回发?

Try this below...It's answered here 请在下面尝试... 在这里回答

function cancelPostBack() {
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if (prm.get_isInAsyncPostBack()) {
    prm.abortPostBack();
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM