Hi Friends,
This code was working fine ...but today its giving me error:
Microsoft JScript runtime error: '0.type' is null or not an object
Thanks & Regards,
Mithun.
Using javascript code to validate the checkbox in Grid view
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Jignesh TrivediRank #16 · 50.3K reputationPosted May 29, 2012, 12:54 AM EDT
I think This error due to find some null object and you cannot access null object property.
so try..
function validateCheckBoxes() {
var isValid = false;
var gridView = document.getElementById('<%= GrdEmp.ClientID %>');
for (var i = 1; i < gridView.rows.length; i++) {
var inputs = gridView.rows[i].getElementsByTagName('input');
if (inputs != null && inputs[0] != null) {
if (inputs[0].type == "checkbox") {
if (inputs[0].checked) {
isValid = true;
return true;
}
}
}
}
alert("Please select atleast one checkbox");
return false;
}
you can also use Jquery for same.
hope this will help you.
Vishwas Kadamannaya111 reputationPosted Feb 20, 2013, 9:53 PM EST