In a GridView I have a column of checkboxes and a column of textboxes. I wanted to modify the value of the textbox when the checkbox is checked. jQuery is the perfect fit for this. Here is the code I used:
$(function () {
var $inp = $('input:checkbox');
$inp.bind('click', function () {
var textbox = $(":input:text:eq(" + $inp.index(this) + ")");
if (this.checked == true) {
textbox.val('123ABC');
textbox.attr('disabled', 'disabled');
} else {
textbox.attr('disabled', '');
}
});
});
This post uses ideas from Suprotim Agarwal.