ASP.Net double-click problem
Posted
by David Archer
on Stack Overflow
See other posts from Stack Overflow
or by David Archer
Published on 2009-09-30T13:54:11Z
Indexed on
2010/03/09
4:21 UTC
Read the original article
Hit count: 522
Hi there, having a slight problem with an ASP.net page of mine. If a user were to double click on a "submit" button it will write to the database twice (i.e. carry out the 'onclick' method on the imagebutton twice)
How can I make it so that if a user clicks on the imagebutton, just the imagebutton is disabled?
I've tried:
<asp:ImageButton
runat="server"
ID="VerifyStepContinue"
ImageUrl=image src
ToolTip="Go"
TabIndex="98"
CausesValidation="true"
OnClick="methodName"
OnClientClick="this.disabled = true;" />
But this OnClientClick property completely stops the page from being submitted! Any help?
Sorry, yes, I do have Validation controls... hence the icky problem.
© Stack Overflow or respective owner