jackjohnson44
asked on
checkbox .net prevent from changing state based on condition
how can I put code in a checkbox event that calls another function, if it returns a false, prevent the checkbox from changing state?
checkbox_onclick()
if (somefunction) then
checkbox.checked = state before it was just clicked
end if
checkbox_onclick()
if (somefunction) then
checkbox.checked = state before it was just clicked
end if
And, you didn't want to disable the CheckBox?
Bob
Bob
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you could create a Session variable and set it before checkbox click event is called:
Session("status")=checkbox .checked
checkbox_onclick()
if (somefunction) then
checkbox.checked = Session("status")
end if
Session("status")=checkbox
checkbox_onclick()
if (somefunction) then
checkbox.checked = Session("status")
end if
Dim myState as Boolean = checkboxvalue
if somefunction then
checkbox.checked = mystate
end if