function CheckAllDataGridCheckBoxes(aspCheckBoxID, checkVal)
{
re = new RegExp(':' + aspCheckBoxID + '$') //generated controlname
starts with a colon
for(i = 0; i < document.forms[0].elements.length; i++)
{
elm = document.forms[0].elements[i]
if (elm.type == 'checkbox')
{
if (re.test(elm.name))
{
elm.checked = checkVal
}
}
}
}
and in javascript
<script language="javascript">
function watchChkList(key,value)
{
var existing;
existing=document.getElementById('hdData').value;
if(document.getElementById(key).checked==true)
{
if(existing !="") existing+=",";
existing+=value;
}else existing=existing.replace(value,'');
document.getElementById('hdData').value=existing;
}
function finalCheck(s,e)
{
var existing;
existing=document.getElementById('hdData').value;
if(existing.indexOf('J010')>=0 && existing.indexOf('J011')>=0)
e.IsValid=false;
}
</script>
Here hdData is a hiddenControl which collects all the values of the checkboxes.
This finalCheck is assigned to a custom validator and it works fine.
Thanks group, for your suggessions
Sreetharan S.T