Hi,
I'm using devexpress aspxbutton, and I was wondering how can I prevent the user from clicking the button more then once..? basically it does an update/insert statement.
Thanks,
Tom
Hi,
I'm using devexpress aspxbutton, and I was wondering how can I prevent the user from clicking the button more then once..? basically it does an update/insert statement.
Thanks,
Tom
Not sure about aspxbutton specifically but in general you will have something like this on the onclick attribute of the control.
onclick="this.disabled=true;"
On the client side, you can disable it when it's clicked.
On the server side, my favourite approach is generally to send a nonce with the form data, and then reject duplicate nonces.
As always, client side validates in a fast and (hopefully) friendly way, server side validates for sure even if client side code suffers from some unexpected browser issue, or someone is deliberately messing things up.
Hi,
This can be done using the following code:
var buttonClicked = false;
function MyBtnClick(s,e){
if(buttonClicked) return;
buttonClicked = true;
// do something
}
<ASPxButton id="btn" runat="server">
<ClientSideEvents Click="function(s,e) { MyBtnClick(s,e); } "/>
</ASPxButton>