Click here to Skip to main content
16,015,393 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am Doing A project In That I Have To avoid double Click.Because The Data Inserts Twice to the database.
Please,Can Anyone Help?


Thanking You

With regards
NanKi
Posted
Updated 18-Jan-12 18:35pm
v2

It will not be better to prevent from double click(actually not double click,but submitting twice).
The better approch is to use unique constraints for combination of columns.If they will be inserted again,it will thrown a exception.
 
Share this answer
 
Hi,

Try disabling the button on first click or change the text from submit to submitting...with javascript

<input type="submit" id="btnSubmit" value="Submit"
   onclick="this.disabled=true;this.value='Submitting...'; this.form.submit();">



For the server side button,

OnClientClick call a java function which does this work of disabling and changing text.And onClick of the asp button, call the asp method you want.


hope this helps.
 
Share this answer
 
v3
Comments
Nandakishore G N 19-Jan-12 0:35am    
Thanks...Kota...But I Need For server control not for html control..
manognya kota 19-Jan-12 0:42am    
OnClientClick call a java function which does this work of disabling and changing text.And onClick of the asp button, call the asp method you want.
You need to know few things while working with databases like Data Concurrency[^]

hope it helps :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900