Link to home
Start Free TrialLog in
Avatar of igotstehsolution
igotstehsolution

asked on

asp:CheckBox oncheck="function1();" onUncheck="function2(); how do I?

Currently I have:

<asp:CheckBox runat="server" Enabled="true" ID="alreadyowndomain" Text="I already own the domain name(s) I need."  onclick="slidedown('alreadyTakenDiv');" onUnCheck="slideup('alreadyTakenDiv');" />

onclick works.
onUnCheck doesn't work.

What I am trying to do is get slidedown('alreadyTakenDiv'); when checked.
and slideup('alreadyTakenDiv') when unchecked.

How can I do this?

Thanks sooo much ahead of time.
Avatar of Aksh
Aksh
Flag of United States of America image

Set AutoPostback to true
Avatar of igotstehsolution
igotstehsolution

ASKER

AutoPostback breaks the javascript.

Anyways I do even know that onUnCheck is a real attribute. I put it there as an example.

Ideally i would need 2 attributes such as onCheck and onUnCheck where I could put a function in each.

Is this possible and how can I do this?
Avatar of leakim971
Use this :


<asp:CheckBox runat="server" Enabled="true" ID="alreadyowndomain" Text="I already own the domain name(s) I need." onclick="slide(this.checked,'alreadyTakenDiv');" />

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
that breaks the function aswell.

<asp:CheckBox runat="server" Enabled="true" ID="alreadyowndomain" Text="I already own the domain name(s) I need."  onCheck="slidedown('alreadyTakenDiv');" onUnCheck="slideup('alreadyTakenDiv');" />

I need it to look like the tag above. The only problem is I don't think onCheck or onUnCheck are real attributes.
onCheck and onUnCheck is not javascript attributes but ASP.NET attributes so running on the server side.

>that breaks the function aswell.
Why ? You call an intermediate function to call the right one (the onUnCheck or onCheck method)
didn't see function when typed response. testing now :)
Works perfect thank soo much!!