After my onclientclick event finishes, I am trying to run my onclick event. However, regardless of whether my checkbox is selected or not, the program keeps prompting me to "Please select at least one to delete." Can anyone help me figure out why this is happening?
I suspect that the issue may lie with my return value. Any assistance is appreciated. Thank you!
<script type="text/javascript">
function validate() {
var gridView = document.getElementById("<%=grid1.ClientID %>");
var checkBoxes = gridView.getElementsByTagName("input");
for (var i = 0; i < checkBoxes.length; i++) {
if (checkBoxes[i].checked) {
if (confirm("Are you sure you want to delete?")) {
alert("Ok");
}
}
else{
alert("Please select at least one item to delete.");
return false;
}
return false;
}
}
</script>