OnClientClick is a client-side event-handling method that is typically handled using JavaScript, which is run directly on the IE side, with a single click.
The onclick is the server-side event handling method that runs on the server side, IIS, and then executes the postback before running
OnClientClick are often used to perform some client-side testing. Of course, it can also be placed on the server side of the detection, but need to interact with the server, consume resources, and the user experience is not good.
When there is both OnClick and OnClientClick on a control,OnClientClick executes before the onclick
The correct wording should be:
<asp:button id= "btnsave" runat= "Server" text= "Save" onclick= "Btnsave_click" onclientclick= "return Savefunc ();"/ >
The SAVEFUNC validates the data, and when the validation is performed by returning true, the server-side method is saved, and the server-side save method is not executed by the validation without returning false.
The wrong wording:
<!--performs a server-side approach regardless of whether validation is passed, and does not achieve the purpose of verification-
<asp:button id= "btnsave" runat= "Server" text= "Save" onclick= "Btnsave_click" onclientclick= "Savefunc ();"/>
<!--returns false regardless of the validation result, the server-side method never executes--
<asp:button id= "btnsave" runat= "Server" text= "Save" onclick= "Btnsave_click" onclientclick= "Savefunc (); return false; "/>
OnClick and OnClientClick