A simple ASP. NET page, add a submit button (ASP: button) in an email input box. All you need to do is verify that the input content meets the email requirements through requiredfieldvalidator and regularexpressionvalidator, click the submit button to perform the submit operation.
The problem here is that, if this is the case, when we click the submit button, if the entered content does not meet the requirements, the control will directly display the error message and the page will not be refreshed again, in fact, the control generates a series of scripts to make judgments, which is the same as writing JavaScript on our own. If we add the onclientclick event to the button and add some scripts by ourselves, the verification control will still take effect, however, whether to stop button submission depends on whether the content returned by the onclientclick event is false or true. At the same time, the page will be PostBack and execute the backgroundCodeIn fact, the so-called verification control also binds its own script to the button and controls its submission time. If we write the client script by ourselves, it is necessary to take full responsibility for determining whether to submit, rather than placing all the responsibility on the server-side controls.