回发过程中禁用一个asp.net动态按钮单击事件之后允许它 [英] Disable an asp.net dynamic button click event during postback and enable it afterwards
问题描述
我在我的code动态创建一个按钮和一个click事件附加到它。不过,我不得不prevent人们点击它,而有事情的过程。所以被点击一次时,它应该被禁止时,处理结束它应该被启用。我该怎么做?
I am creating a button dynamically in my code and attaching a click event to it. However I have to prevent people to click it while there is a process going on. So when it is clicked once, it should be disabled and when the process ends it should be enabled. How can I do that?
感谢。
推荐答案
的onclick =this.enabled = FALSE从code背后添加到您的控制。
onclick="this.enabled=false" add this from your code behind to your control
btnAdd.Attributes.Add(onclick事件,this.enabled = FALSE;);
btnAdd.Attributes.Add("onclick", "this.enabled=false;");
这个链接详细解释的http:// encosia.com/2007/04/17/disable-a-button-control-during-postback/
这篇关于回发过程中禁用一个asp.net动态按钮单击事件之后允许它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!