$(document).ready(function () {
$("#gv tr:first th:first").find('[type="checkbox"]').click(function () { //gridView命名为gv
if ($(this).attr("checked")) {
$("#gv").find('[type="checkbox"]').not('[checked="true"]').attr("checked", "true");
}
else {
$("#gv").find('[type="checkbox"]').removeAttr("checked");
}
})
$("#gv tr").not(':first').find('[type="checkbox"]').click(function () {
var checkCount = $("#gv tr").not(':first').find('[type="checkbox"][checked="true"]').size();
if (checkCount == $("#gv tr").not(':first').find('[type="checkbox"]').size()) {
$("#gv tr:first th:first").find('[type="checkbox"]').attr("checked", "true");
}
else {
$("#gv tr:first th:first").find('[type="checkbox"]').removeAttr("checked");
}
})
})