Jump to content

"Check All" checkbox wrongly select another gridview


joeyan

Recommended Posts

I had 3 different gridview in same asp page, each gridview have its own 'Check All" checkbox button in header and a checkbox in each row of the gridview as I need to do some batch update & insert for selected rows.my problem is that if I check the "Check All" checkbox in either one gridview, it will check all the checkbox including other gridview. I had already declared the gridview id in th code.how can i control the "check All" checkbox to check the checkbox in its own gridview only ? Thanks.

function selectAllGridview1(id) {        var grid = document.getElementById("<%= GridView1ClientID %>");        var cell;        if (grid.rows.length > 0) {            for (i = 1; i < grid.rows.length; i++) {                cell = grid.rows[i].cells[0];                for (j = 0; j < cell.childNodes.length; j++) {                    if (cell.childNodes[j].type == "checkbox") {                        cell.childNodes[j].checked = document.getElementById(id).checked;                    }                }            }        }               }

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...