Click here to Skip to main content
15,888,082 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hey Every One this is my code. I am doing textbox visible on radiobutton click. This code working. But if I am using autopostback.

C#
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
   {

       if(RadioButton1.Checked)
       {
           TextBox1.Visible = true;
       }
       else
       {
           TextBox1.Visible = false;

       }
   }


How to do this textbox visible on radio button click but without using autopostback..
Posted
Updated 15-Jul-13 8:33am
v2
Comments
ZurdoDev 15-Jul-13 14:08pm    
Use JavaScript.

Hi
You must use form JavaScript.
For hide a element by JavaScript you can use from bellow code:
JavaScript
<script type="text/javascript">
    function YourFunctionName() {
        document.getElementById('YourTextBoxID').style.visibility = 'hidden';
        return true;
    }
</script>


For showa element by JavaScript you can use from bellow code:
JavaScript
<script type="text/javascript">
    function YourFunctionName() {
        document.getElementById('YourTextBoxID').style.visibility = 'visible';
        return true;
    }
</script>


For call this function you can use from bellow code:
C#
Radio1<input type="radio" id="TestRadio1" name="RadioName1" value="RadioButton1"  önclick="return YourFunctionName();" />


I hope it's helpful for you.
 
Share this answer
 
v2

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