Showing posts with label Find Control Inside GridView in Javascript. Show all posts
Showing posts with label Find Control Inside GridView in Javascript. Show all posts

Wednesday, 23 January 2013

Find Control Inside GridView in Javascript

function SelectAll(id) {
            var grd = document.getElementById("<%= GridView1.ClientID %>");
            var cell;
            if (grd.rows.length > 0) {
                for (i = 1; i < grd.rows.length; i++) {

                    cell = grd.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;
                        }
                    }
                }
            }
        }

Total Pageviews