简体   繁体   English

按钮调用事件未调用

[英]Button click event not called

I want to disable a button, only using javascript. 我想仅使用javascript禁用按钮。

I have one button on the form. 我在表单上有一个按钮。 I want to disable that button from javascript. 我想从javascript禁用该按钮。 When I try to do this, the button submit click event is not calling. 当我尝试执行此操作时,按钮提交单击事件未调用。

I used following code on javascript: 我在javascript上使用了以下代码:

document.getElementById('<%=imgSubmit.ClientID%>').disabled = true; 

The button get disabled; 按钮被禁用; but its button click event on server side is not being called. 但是没有调用其在服务器端的按钮单击事件。

When I remove this javascript then it is calling the server side click event. 当我删除此javascript时,它正在调用服务器端单击事件。 What is the issue with disabling the button from javascript?? 从javascript禁用按钮有什么问题?

Well if the button is disabled it is not going to fire the server side event. 好吧,如果该按钮被禁用,则不会触发服务器端事件。 Try submitting the form from the client side. 尝试从客户端提交表单。

document.getElementById('<%=imgSubmit.ClientID%>').disabled = true; 
Form1.submit();

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

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