I have an ASP.NET button that I need to disable after the user clicks it to prevent double-clicking. Once the submit completes it has to be enabled again. Can anyone help me with this?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- Carriage Return (ASCII chr 13) is missing from tex
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
I like to disable the button and call a postback, this way the code behind still gets run after the button is disabled.
this is how i attach from code behind:
Then re-enable the button in code behind:
Disable the button on the OnClick event, then re-enable on the AJAX callback event handler. Here is how I do it with jQuery.
I have found this, and it works:
Just need to add 2 attributes for asp button :
e.g.
For more details:
https://bytes.com/topic/asp-net/answers/918280-disable-button-click-prevent-multiple-postbacks
You can do this with javascript. in your
form
tag,onsubmit="javascript:this.getElementById("submitButton").disabled='true';"
You can use the client-side onclick event to do that: