This is untested, but you could add a common class to the items you want to enable and disable like this
class="rowControl"
Then, adjust it like this:
var myControl = $("[id~="+idstr+"].rowControl");
...
if (this.checked) {
myControl.removeAttr('disabled').removeClass('aspNetDisabled').removeAttr("style");
} else {
myControl.attr('disabled', 'disabled').addClass('aspNetDisabled').attr('style', newTBStyle);
}
While it doesn't do everything you need, it would adjust ALL elements with that class. You can add back the parts that are missing (like setting specific values).
NOTE: var myControl = $("[id~="+idstr+"].rowControl");
will select all elements with the id
containing idstr
and class rowControl
.