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 my button :
<button id="btnSave" onserverclick="btnAddUser_Click" name="btnSave" type="submit" style="font-size:11px;font-family:Verdana;font-weight:bold;" runat="server">Save</button>
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.
I just came across this same problem and wanted to point out that removing the "Handles btnSave.Click" from your event will prevent it from being called twice. For Example, use this in the code behind:
Protected Sub btnSave_OnClick(ByVal sender As Object, ByVal e As System.EventArgs)
'Do Something
End Sub
Instead of this:
Protected Sub _btnSave_OnClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
'Do Something
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With