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

后端 未结 1 468
北荒
北荒 2020-12-01 23:57

In an asp.net user control I have a button:

相关标签:
1条回答
  • 2020-12-02 00:45

    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;"

    0 讨论(0)
提交回复
热议问题