如何阻止项目中的双击? [英] How to block double click in a project?

查看:131
本文介绍了如何阻止项目中的双击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面中有一个按钮.如果单击按钮,则将执行一些代码.需要一些时间.在执行期间,如果我再次单击该按钮,则它将从代码的第一行开始执行.现在,我想阻止单击,直到执行过程完成.
在此期间,如果有人单击该按钮,则我将显示一条警告消息页面已提交"或其他..

注意:我正在使用asp.net C#

有没有人可以解决我的问题?

在此先感谢
Rashed

I have a button in a page. If I click the button then some code executes. It takes some time. During execution time if I click the button again then it starts to execute from the first line of the code. Now I want to block the clicking until the execution process is finished.
During that time if anyone click the button then I will show a alert message "Page already submitted" or others..

NB: I am using asp.net C#

Is there any one to solve my problem?

Thanks in advance
Rashed

推荐答案

最简单的解决方案是在第一次单击时禁用按钮,然后在整个代码执行后再次启用它.

在禁用JavaScript代码中的按钮时调用警报.

有关更多信息,请查看
http://forums.asp.net/t/1057086.aspx/1?Disable + button + on + submit + to + prevent + double + submission [令人惊叹的ASP.NET仅一次可单击"按钮 [
The simplest solution is to disable the button on the first click and then enable it again once the entire code executes.

Call the alert as you disable the button in the JavaScript code.

For more info, check out
http://forums.asp.net/t/1057086.aspx/1?Disable+button+on+submit+to+prevent+double+submission[^]
The amazing ASP.NET "One Time Only Clickable" Button[^]


这篇关于如何阻止项目中的双击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆