function CheckAllDataGridCheckBoxes(aspCheckBoxID, checkVal)
{
for(i = 0; i <= document.forms[0].elements.length; i++)
{
elm = document.forms[0].elements[i]
if (elm.type == 'checkbox')
{
elm.checked = checkVal;
}
}
}
This code snippet has been tested to work on a datagrid with checkboxes named as aspCheckBoxID. The input parameter of checkVal is the value of the checkbox which is either true or false (true if you want to check all check box, and false if otherwise).