Onclick: Execute C # code. Onclientclick: execute JavaScript code.
Onclientclick occurs before onclick. Generally, the script is executed.
Return true: Execute The onclick event. Return false: do nothing.
Onclick is the server event of the button, and onclientclick is the client event of the button.
Generally, we use onclientclick to verify the submitted data, but this must return true or false, that is, we must add return, otherwise the onclick is invalid. When false is returned, The onclick server event is aborted. If your JS verification has an error, the server event onclick is directly executed. To avoid such errors, you can use server-side verification to save the onclientclick event, so you do not need to consider conflicts with onclick. However, in terms of performance, server-side verification consumes server resources. In general, it is okay, but it is only compared with client verification. It has its own strengths and weaknesses.
Original post address: http://blog.sina.com.cn/s/blog_5f93dbd90100lfmw.html