button firing click event twice

后端 未结 14 2104
忘了有多久
忘了有多久 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:16

    I think I just figured a solution for it. Remove name="btnSave" or change it to "btnSave1". It will work.

    0 讨论(0)
  • 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.

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