I thing, the best way would be doing it on the client side only (it this is acceptable; some sites are required to perform even it the user switched scripting off in the browser), because the postback for this simple operation would might take to much time to be reasonable. That said, you could do it in JavaScript; and one convenient way of doing it would be using jQuery.
To enable/disable, you can use this:
$('#myTextBoxId').removeAttr('disabled');
$('#myTextBoxId').attr('disabled', '');
You can handle the
click
event of the text, check if it is checked and enable or disable the text box accordingly:
$('#myCheckBox').click (function () {
var thisCheck = $(this);
if (thischeck.is (':checked')) {
} else {
}
});
Something like that.
Please see:
http://docs.jquery.com/Main_Page[
^],
http://api.jquery.com/category/attributes/[
^] (see how to work with attributes),
http://api.jquery.com/checked-selector/[
^] (working with "checked").
—SA