Freigeben über


SharePoint Application Page Button Click Not Working After First Click

I was recently working on a SharePoint Application Page and encountered an issue whereby button clicks were only working for the first click.  The second and subsequent clicks weren't working.

The issue appears to be due to SharePoint interfering with the JavaScript that is necessary to process an ASP.NET post-back.  Anyway, adding an OnClientClick attribute as illustrated in the following example resolved the issue for me.  I hope this helps you to overcome this issue if you happen to encounter it also!

<asp:Button ID="btnMybutton" runat="server" OnClick="btnMybutton_OnClick" Text="Button" OnClientClick="_spFormOnSubmitCalled = false;" />