Html button handler fires twice on ServerClick


Problem:

There is a scenario where a "button" HTML element may fire two ServerClick events off. In the old days, this usually meant that the button had AutoEventWireup set and was also manually being set (thus wiring in twice). That is not the case in this scenario.

Solution:

In this case, the button element also needs to have it's type set to "submit" instead of "button" and this may cause the behavior of firing twice. Trying switching the property and see if it fixes the issue.

Correct ASP.NET Markup

<button id="btnSave" type="button" runat="server" onserverclick="btnSave_Click">

Incorrect ASP.NET Markup

<button id="btnSave" type="submit" runat="server" onserverclick="btnSave_Click">