I have a form which inserts data in DB on Submit button click but the problem is when client click the button multiple times its sends multiple create requests means multiple button click events for the same time of same data, which must not be.
I tried to disable the button when client click the Submit button first time but after this it does not call server click event handler or not fire the server click event once it got disabled.
How to handle this multiple click problem..
I used the following code to disable the button
<script type="text/javascript">
function checkAuth(obj)
{
if(Page_ClientValidate("ValidationGroupName"))
obj.disabled=true;
}
</script>
<asp:Button ID="btnSubmit" runat="server" Text="Submit"
OnClick="btnSubmit_click" OnClientClick="checkAuth(this)" CssClass="FormButton"
ValidationGroup="ValidationGroupName" />
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…