Click here to Skip to main content
14,921,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all,
Here i want to prevent double click. while adding entries.

Design code:-
<asp:Button ID="btnSave" ValidationGroup="Save" runat="server" CssClass="savebutton"
                                                                                   EnableTheming="false" SkinID="skinBtnSave" OnClick="btnSave_Click"  />

how to prevent double click in coding page (i.e)
.cs page

protected void btnSave_Click(object sender, EventArgs e)

Kindly teach me.
Sorry, it sounds nonsense: what do you mean "prevent"? a user can do any number of clicks anywhere. You have no power to hold user's finger... :-)
What exactly do you want to achieve?
JOTHI KUMAR Member 10918227 14-Feb-15 3:32am
i want to achieve while clicking save button.the user can do any number of click while saving the entry. i need when user click once then not able to allow click another time.

1 solution

Disable the button in JavaScript on "clientClick" event on aspx page. So only that click event will be fired and next user can click button but it will be inactive. So it will not causes post back again. Enable the button in ur server side method once data is saved successfully using buttonId.enable=true. Remember as long as button is enabled, it invokes button click event.

Add dis for button save OnClientClick="fnBtnHide()"
Add this on header section of HTML.

Function fnBtnHide()

Your code will be working as expected.
JOTHI KUMAR Member 10918227 14-Feb-15 5:33am
how can i do kindly tell me any javascript
Shridhar Gowda 14-Feb-15 13:57pm
And updated

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