Prevent LinkButton post back OnClientClick not working. Why?

前端 未结 4 1696
天涯浪人
天涯浪人 2020-12-02 00:37

I know there are plenty of answers surrounding this topic but I just cannot get this to work.

I need to prevent a link button posting back and the following code is

4条回答
  •  余生分开走
    2020-12-02 01:26

    Right, figured it out. I needed to include the return statement in the OnClientClick attribute:

    OnClientClick="return showConfirm(event);"
    

    NOT

    OnClientClick="showConfirm(event);"
    

提交回复
热议问题