DH
Programmer
- Dec 8, 2000
- 168
I am using the following Javascript shown below to check or uncheck all checkboxes with the id 'DeleteThis' in a asp.net datagrid. This functionality allows the user to select various records to be deleted for example.
The problem is that I also have a radio button list named 'searchby' on the same form. When I use check the select_deselectAll function it also changes the value of the 'searchby' radio list. How can I tell the select_deselectAll to ignore the 'searchby' radio list and only check/uncheck the checkboxes within the datagrid with the id of 'DeleteThis'?
I am not very familar with Javascript and any help will be very appreciated!
Javascript:
Thank you.
DH
The problem is that I also have a radio button list named 'searchby' on the same form. When I use check the select_deselectAll function it also changes the value of the 'searchby' radio list. How can I tell the select_deselectAll to ignore the 'searchby' radio list and only check/uncheck the checkboxes within the datagrid with the id of 'DeleteThis'?
I am not very familar with Javascript and any help will be very appreciated!
Javascript:
Code:
<script language=JavaScript>
<!--
/*Using modified select_deselectAll script function of my original one, from Developerfusion.com forum members - ketcapli & thombo Forum Post - [[URL unfurl="true"]http://www.developerfusion.co.uk/forums/topic-22773[/URL]]*/function select_deselectAll (chkVal, idVal) {
var frm = document.forms[0];
if (idVal.indexOf('DeleteThis') != -1 && chkVal == true){
var AllAreSelected = true;
for (i=0; i<frm.length; i++) {
if (frm.elements[i].id.indexOf('DeleteThis') != -1 && frm.elements[i].checked == false){
AllAreSelected = false;
break;
}
}
if(AllAreSelected == true){
for (j=0; j<frm.length; j++) {
if (frm.elements[j].id.indexOf ('CheckAll') != -1) {
frm.elements[j].checked = true;
break;
}
}
}
} else {
for (i=0; i<frm.length; i++) {
if (idVal.indexOf ('CheckAll') != -1) {
if(chkVal == true) {
frm.elements[i].checked = true;
} else {
frm.elements[i].checked = false;
}
} else if (idVal.indexOf('DeleteThis') != -1 && frm.elements[i].checked == false) {
for (j=0; j<frm.length; j++) {
if (frm.elements[j].id.indexOf ('CheckAll') != -1) {
frm.elements[j].checked = false;
break;
}
}
}
}
}
}
//-->
</script>
DH