Create an Asp.net Gridview with Checkbox in each row
- by ybbest
One of the frequent requirements for Asp.net Gridview is to add a checkbox for each row and a checkbox to select all the items like the Gridview below. This can be easily achieved by using jQuery. You can find the complete source doe here.
$(document).ready(function () {
$(‘input[name$="CDSelectAll"]‘).click(function () {
if ($(this).attr(“checked”)) {
$(‘input[name$="CDSelect"]‘).attr(‘checked’, ‘checked’);
} else {
$(‘input[name$="CDSelect"]‘).removeAttr(‘checked’);
}
});
});