- cannot manually edit applicationhost.config
- must declare the scalar variable
- classic asp and access not working on windows 2008 64bit
- asp.net page titles are blank
- sql to get totals for last six months
- white space being counted as a node
- cross page posting not working
- collection is read only exception
- PayPal sending incorrect carrier information
- paypal guest user notice
- classic asp dictionary not working
- IE8 not supporting innerHTML
- differences between jet and odbc
- sugarcrm not inserting email
- select random records from access
- button click event firing twice
- how to send an email using cdosys
- installing perl on win2003 64 bit
- asp.net page event order
- rewrite rule for subdomains only
- extra items in javascript array
- IE7 margin auto not working
- IE7 border style dotted glitch
- ByRef and ByVal in vbscript
- weather rss feed
- Classic asp crib sheet
- Firefox onsubmit image change
- limit records in access
- AccessDataSource is thick
- double margins in IE6
- extra image padding in html emails
- decimal places in linux flash player
- broken emails in outlook 2007
- double spaced IE list items
- cannot remove movieclip
articles:
button click event firing twice
We recently had several button controls that were consistently firing twice on click. After a fair amount of head scratching and feeling stupid, it turns out that we were handling the button click twice - not really surprising that the event was firing twice then.
The reason the click was being handled twice was because the onclick handler was being specified twice: once in the button tag as the OnClick attribute:
<asp:Button ID="myButton" runat="server" Text="my button" OnClick="myButton_Click" />
and once in the code behind
Protected Sub myButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles myButton.Click
Simply removing the OnClick attribute from the button tag solved this problem.
Comments
Posted on 04 February 2011 15:58:00 GMT by ylva
Jesh, I did the same, how silly! Thanks for the post, it was what made me look twice ;)
Posted on 18 April 2011 08:13:00 GMT by santosh kakani
Nice article dude
i will post same in my blog too
you saved my $12 value
:)
i will post same in my blog too
you saved my $12 value
:)
Posted on 15 July 2011 09:05:00 GMT by Chris Crookes
I just did exactly the same thing, I thought it was to do with my method of adding a row to a datagrid and eventually used a response.write() to see what was happening. Stoopid me :(
Posted on 27 September 2011 11:15:00 GMT by winston
Awesome, just found the exact same thing in the code I'm working on.
Posted on 02 November 2011 09:36:00 GMT by sankar
nice article
Post a comment
