nkg
nkg

Reputation: 961

Check a check box if another check box in same row is chekd in a GridView

I have a Gridview, each row with two check box, on the check of second checkbox i want the first check box to be checked automatically.I'm looking for Clent side scripts...Please help

Upvotes: 0

Views: 246

Answers (1)

Sudhakar B
Sudhakar B

Reputation: 1563

Try this

var rows = $("#your table tr:gt(0)"); // skip the header row

rows.each(function(index) {
    var lastCheckbox = $("td:nth-child(youlast checkbox cell) input", this);
    var firstCheckBox=$("td:nth-child(firstCheckboxCellIndex) input", this);
    $(lastCheckbox).change(function(e) { $(firstCheckBox).attr('checked',$(this).is(':checked'));
});;

Upvotes: 1

Related Questions