I'd like to instantly disable a Button after clicking it, so a User can't click it twice in short succession and fire the OnClick_Event twice in a row. btn.Enabled = false
doesn't seem to do the trick instantly. Is there any other way to accomplish this?
Thanks,
Dennis
What you are doing is disabling it after a post back therefore your button will be disabled in the page that's rendered when the browser receives the response.
Do it on the client-side with JavaScript instead:
var button = document.getElementById('yourButton');
button.disabled = true;
If you're facing issues with posting back to the server, check out this article: How to disable an ASP.NET button when clicked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With