button firing click event twice

后端 未结 14 2102
忘了有多久
忘了有多久 2021-02-07 21:28

It seems that sometimes (but not always) my button click event is being fired twice. The fact that it seems to happen sometimes but not always is really puzzling me. Here is m

14条回答
  •  青春惊慌失措
    2021-02-07 22:17

    If you are using asp.net, just use asp:button.....its clean and simple. No matter what justification i read on the net, it makes no sense that the server side handler should be called twice. When I add type="button", the problem is solved. However the form is not submitted when I press enter key. So that's another issue to be resolved. Using the asp:button takes care of all this.

提交回复
热议问题