ASP. NET prevents the button from submitting the core implementation code multiple times

  • 2020-06-23 00:11:48
  • OfStack

 
<asp:Button ID="btnSubmit" runat="server" UseSubmitBehavior="false" OnClientClick="this.disabled=true; " Text="Submit" OnClick="Button1_Click" /> 

Mainly to add
 
UseSubmitBehavior="false" OnClientClick="this.disabled=true; "2 A property   You can prevent multiple commits  

Ask for a question by the way

When this is set, the disabled property of Button1_Click will be changed to false, that is, the background event will be executed and can be clicked again

Button1_Click event using this. btnSubmit. Enabled = false;

How to use JS control, click once to disable it, that is, remove this. btnSubmit. Enabled = false; This pray to the great God

Related articles: