CheckBox control doesn't have a onchange event, and onchange event will be rendered in a <span> tag and not the <input> tag. OnCheckedChanged generates a onclick event for the <input> tag to cause a postback. It's browser's feature that which should be fired
first.
You can try this code snippet, this should work
<asp:CheckBox runat="server" ID="chkPostback" Text="Check me" onclick="javascript:alert('click fired')"
AutoPostBack="true" OnCheckedChanged="PostYourselfBack" />
ztmu
Member
261 Points
59 Posts
onchange client side event of checkbox not firing
Feb 02, 2012 03:08 PM|LINK
client side onchange event of asp.net:checkbox is not firing in chrome, works in firefox and IE any suggestions?
<asp:CheckBox runat="server" ID="chkPostback" Text="Check me" onchange="javascript:alert('check fired')" AutoPostBack="true" OnCheckedChanged="PostYourselfBack"/>srinanthuram
Contributor
6800 Points
1549 Posts
Re: onchange client side event of checkbox not firing
Feb 02, 2012 03:22 PM|LINK
hi
see this url
http://stackoverflow.com/questions/8155077/checkbox-event-can-not-find-javascript-function
http://www.codingforums.com/archive/index.php/t-88695.html
thank u
Zhongqing Ta...
Star
10512 Points
1354 Posts
Re: onchange client side event of checkbox not firing
Feb 06, 2012 07:32 AM|LINK
Hi ztmu,
CheckBox control doesn't have a onchange event, and onchange event will be rendered in a <span> tag and not the <input> tag. OnCheckedChanged generates a onclick event for the <input> tag to cause a postback. It's browser's feature that which should be fired first.
You can try this code snippet, this should work
<asp:CheckBox runat="server" ID="chkPostback" Text="Check me" onclick="javascript:alert('click fired')" AutoPostBack="true" OnCheckedChanged="PostYourselfBack" />If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework