How to use a Checkbox change event


#1

Hello,

on a edit-page I have a checkbox and 2 textboxes, a datepicker and a dropdown.
if I click on that checkbox I need to enable/disable (or visible/unvisible) the 2 textboxes and dropdown and datepicker depending of state of the checkbox.

Basicially something like this in checkbox change event:
if (myCheckbox.Value==true) textbox1.disabled=false else textbox1.disabled=true
( or better maybe textbox1.disabled = !myCheckbox.Value)

I guess this is easy to achieve but I dont know how to do it and could not find sample code for this.


#2

The easiest way is to create a page property and data-bind the Checkbox's Value property to it: ${textBoxVisible}. Then set the Visible property of those textboxes to ${textBoxVisible}. You don't need to handle the Change event of the textbox if you go this way.


#3

ok, works. Thank you