button firing click event twice

后端 未结 14 2071
忘了有多久
忘了有多久 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 21:54

    One possible reason:
    Check your button declaration in your .aspx source. If you have a 'runat=server' and onclick="button1_click", and you have an event handler in your code-behind (ie. .aspx.vb), it will cause the event to be fired twice. Here is an example in xxx.aspx:

    
    

    This declaration should be:

    
    

    Good luck!

提交回复
热议问题