单击时禁用按钮

编程入门 行业动态 更新时间:2024-10-28 18:25:47
本文介绍了单击时禁用按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个带按钮的ASP.Net页面. 我需要在单击按钮时禁用该按钮,处理一些代码,并且在处理代码时应重新启用该按钮. 我写了下面的代码.

I have an ASP.Net page with a button. I need to disable the button when it is clicked, process some code and when code is processed the button should be enabled back. I wrote below code.

Button.enabled = false /* code */ Button.enabled = true

但是,它不会更改按钮的状态. 我也尝试过使用JavaScript,它禁用了按钮,但不处理代码并重新启用按钮.

but, it does not change the status of the button. I also tried with JavaScript, it disables the button but doesnt process the code and reenable the button.

script.RegisterClientScriptBlock(Me.GetType(), "ButtonStatus", "document.getElementById(''ButtonName'').enables = false;") /* code */ script.RegisterClientScriptBlock(Me.GetType(), "ButtonStatus", "document.getElementById(''ButtonName'').enables = true;")

关于这个人的任何建议...

Any suggestion on this guys...

推荐答案

谢谢您的提问. Thank you for your question. Button1.Enabled = false; foreach (GridViewRow row1 in GridView1.Rows) { CheckBox chk = (CheckBox)row1.FindControl("chkId"); if (chk.Checked) { String strTem = chk.ID; } } Button1.Enabled = true;

我已经使用了上面的代码,但没有发现此问题作为您的问题. 谢谢

I have used above code but did not find this problem as your question. Thanks

看看这个 在Asp中禁用多个按钮单击 [ ^ ] Have a look at this one Disable Multiple Button Click in Asp[^]

Hello Sifar! 我认为/* Code */部分在服务器端执行. 如果为真,则因为启用= true ,您将看不到按钮的任何更改. 是在服务器端设置的,并且在浏览器中显示页面时,该按钮已启用. 干杯 曼弗雷德(Manfred) Hello Sifar! I take it that /* Code */ part is executed at the server side. If this is true you wont see any changes on the button since enables = true is set on the server side and when the page is displayed in the browser the button is enabled. Cheers Manfred

更多推荐

单击时禁用按钮

本文发布于:2023-11-10 01:39:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1574007.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单击   按钮

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!