Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello sir,
i have a radio button list with two list items YES & NO.and a Pannel in my asp.net web application
what i want to do is if i select the YES radio button then Pannel will remain in visible mode but if I select NO then my pannel becomes unvisible.

if any one have the sample code then please send us.
thanks in advance.
Posted
Updated 6-Apr-11 1:24am
v2

Try below code:

JavaScript
if(document.getElementById("rbYes").checked == true)
{
    document.getElementById('Panel1').style.display = "none";
}
else
{
    document.getElementById('Panel1').style.display = "block";
}


Replace rbYes and Panel1 with id of yes radiobutton and panel respectively.

Hope it helps!
 
Share this answer
 
If it is a radiobuttonlist Try something like though I didn't test it should work.

C#
function GetRadioButtonValue()

        {

            var rad = document.getElementsByName("radid");

            for (var j = 0; j < rad.length; j++)

            {

                if (radio[j].value='Yes'){
                document.getElementById('Panelid').style.display = "none";
                }
                else
                {
                document.getElementById('Panelid').style.display = "block";
                }                   
            }

        }
 
Share this answer
 

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