It seems that sometimes (but not always) my button click event is being fired twice. The fact that it seems to happen sometimes but not always is really puzzling me. Here is m
Use a native ASP.NET button instead.
<asp:Button id="btnSave" runat="server" OnClick="btnAddUser_Click"
style="font-size:11px;font-family:Verdana;font-weight:bold;" Text="Save" />
I had the same problem, and it took me a while to figure it out! If you add type="button" to your button, it seems to fix the issue.
Just had to delve back into old school ASPX again and found this issue.
My form was set up like this.
<asp:UpdatePanel ID="login" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="forgotPassword" runat="server" DefaultButton="lbtnSendLoginDetails" Visible="False">
<asp:LinkButton ID="lbtnSendLoginDetails" runat="server" >
The code behind was
Protected Sub lbtnSendLoginDetails_Click(sender As Object, e As EventArgs) Handles lbtnSendLoginDetails.Click
The answer for me was to remove the DefaultButton attribute from the Panel and add
TabIndex="4"
to the LinkButton.
If you are using code behind, don't use OnClick in ASP tag, <button id="btnSave" name="btnSave" type="submit" style="font-size:11px;font-family:Verdana;font-weight:bold;" runat="server">Save</button>
In my case, It happens to me when I use Chrome, But not in Firefox
Looks like the problem with wiring up of event handlers. http://geekswithblogs.net/TimH/archive/2006/10/23/94874.aspx
Try if you can just have event handler in your back end. Also, the problem could be because of the type = "Submit". Check if changing it to just Button fixes the problem.