Click here to Skip to main content
15,896,464 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
have tried the below code:
C#
function GLUpos() {

    var ResultsGLU = document.getElementById('rbnGLU');
    var ResultsGLU2 = ResultsGLU.getElementsByTagName('input');

    if (ResultsGLU2[0].checked) {

        document.form1['rbnPosGLU'].item(0).disabled = false;
        document.form1['rbnPosGLU'].item(1).disabled = false;
        document.form1['rbnPosGLU'].item(2).disabled = false;
        document.form1['rbnPosGLU'].item(3).disabled = false;
        document.form1['rbnPosGLU'].item(4).disabled = false;
        document.getElementById('rbnPosGLU').disabled = false;
    }


    if (ResultsGLU2[1].checked) {

        document.form1['rbnPosGLU'].item(0).disabled = true;
        document.form1['rbnPosGLU'].item(1).disabled = true;
        document.form1['rbnPosGLU'].item(2).disabled = true;
        document.form1['rbnPosGLU'].item(3).disabled = true;
        document.form1['rbnPosGLU'].item(4).disabled = true;
        document.form1['rbnPosGLU'].item(0).checked = false;
        document.form1['rbnPosGLU'].item(1).checked = false;
        document.form1['rbnPosGLU'].item(2).checked = false;
        document.form1['rbnPosGLU'].item(3).checked = false;
        document.form1['rbnPosGLU'].item(4).checked = false;
        document.getElementById('rbnPosGLU').disabled = true;
    }

}
Posted

1 solution

Use jquery. Use events. Make event code that fires when a check boxes state is changed, then your code can be a lot simpler than this. It can reset all other checkboxes but the one you clicked ( which is 'this' in the context of your method )
 
Share this answer
 
Comments
Dkinyoki 22-Mar-14 3:46am    
thanks christian for this. Have used jscript in my code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900