一个按钮preventing意外双击 [英] Preventing accidental double clicking on a button

查看:174
本文介绍了一个按钮preventing意外双击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从ASP.NET按钮继承和使用了几个控件onserverclick。

I have a few controls that inherit from ASP.NET buttons and use 'onserverclick'.

如果用户点击了两次,触发按钮2服务器端的事件。我怎样才能prevent呢?

If the user clicks twice, the button fires two server side events. How can I prevent this?

我想通过javascript设置this.disabled =真点击后,(在'的onclick'属性),但阻断第一回发为好。

I tried setting "this.disabled='true'" after the click (in the 'onclick' attribute) via javascript, but that blocks the first postback as well.

推荐答案

请参阅本例中为回发无效控制。它应该帮助你做你想要达到的目标。

See this example for disabling control on postback. It should help you do what you're trying to achieve.

<一个href=\"http://encosia.com/2007/04/17/disable-a-button-control-during-postback/\">http://encosia.com/2007/04/17/disable-a-button-control-during-postback/

这篇关于一个按钮preventing意外双击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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