The OnCheckedChanged event is a server side event. Therefore, the page needs to see a server side function that will handle the event. The best thing to do is to handle the checkboxes "onclick" event which is client side:
Also, if you just want the checkbox for client side processing then I wouldnt even create an ASP.Net checkbox; I would create an input type="checkbox" instead.
dsk_angst
Member
375 Points
75 Posts
Calling javascript function from OnCheckedChange event
May 27, 2005 06:23 PM|LINK
<code>
<asp:checkbox id="chkEnglish" OnCheckedChanged="JavaScript:EnableDisable();" Runat="server" />
</code>
That doesn't seem to work. Keep getting an error stating: 'JavaScript' is not a member of 'ASP.WebForm1_aspx'.
what am i doing wrong ?
thanks
--=angst=--
javan15
Participant
1461 Points
337 Posts
Re: Calling javascript function from OnCheckedChange event
May 27, 2005 07:25 PM|LINK
<asp:checkbox id="chkEnglish" OnClick="JavaScript:EnableDisable();" Runat="server" />
Also, if you just want the checkbox for client side processing then I wouldnt even create an ASP.Net checkbox; I would create an input type="checkbox" instead.
dsk_angst
Member
375 Points
75 Posts
Re: Calling javascript function from OnCheckedChange event
Jun 10, 2005 01:12 PM|LINK
shjji4gr8
Member
40 Points
8 Posts
Re: Calling javascript function from OnCheckedChange event
Feb 13, 2009 02:23 PM|LINK
My freind it can also be called simply..by following way:-
<asp:CheckBox ID="cb" runat="server" Text="Group" onclick="enable()" />
ASP.net and Java Developer
Pakistan
fesani
Member
14 Points
7 Posts
Re: Calling javascript function from OnCheckedChange event
Apr 22, 2010 11:45 AM|LINK
thanks shjji, it works for onclick method.