Asp .NET Button – OnClientClick=”return function()” vs OnClientClick=”function()”

First : the client side runs (OnClientClick)

Then – the server side.

But

The client side code can prevent execution of server side by return true/false.

usually we use it for validation , before submitting to server.

Do this and your server side will ( without hacking) never work :

OnClientClick="return false;"

Leave a Comment