Disable postback at click on a button

后端 未结 10 614
名媛妹妹
名媛妹妹 2021-01-03 20:31

I want do disable postback after clicking a . I\'ve tried to do that by assigning onclick=\"return false\", but in the button doe

10条回答
  •  死守一世寂寞
    2021-01-03 21:17

    Seeing as none of these answers helped me. I found a solution. Instead of using the ASP.NET button , you should use the HTML button. It worked perfectly and looks exactly like the ASP.NET button. To get the HTML button to submit on server side, you use the attribute onserverclick.

    
    

    For my code, I was using JS to do something on the server side. The would not stop doing a post back but as I said, the HTML button fixed my problem. Please mark as answer or vote up if this helped you out.

提交回复
热议问题