单选按钮上可见的文本框 [英] textbox visible on radio button

查看:87
本文介绍了单选按钮上可见的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,每一个这都是我的代码。我在radiobutton点击时可见文本框。这段代码有效。但如果我使用autopostback。



Hey Every One this is my code. I am doing textbox visible on radiobutton click. This code working. But if I am using autopostback.

protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
   {

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

       }
   }





如何在单选按钮上显示此文本框但不使用autopostback ..



How to do this textbox visible on radio button click but without using autopostback..

推荐答案

Javascript!这里有几个链接:



http://www.cprogramto.com/select-radio-button-with-text-box-to-be-visible-javascript/ [ ^ ]



http://stackoverflow.com/questions/9634783/how-to-activate-a-textbox-if-i-select-an-other-option-in-drop-下框 [ ^ ]
Javascript! Here's a couple of links:

http://www.cprogramto.com/select-radio-button-with-text-box-to-be-visible-javascript/[^]

http://stackoverflow.com/questions/9634783/how-to-activate-a-textbox-if-i-select-an-other-option-in-drop-down-box[^]


Hi


你必须使用形式JavaScript。

要通过JavaScript隐藏元素,您可以使用以下代码:

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





对于showa元素的JavaScript,您可以使用以下代码:



For showa element by JavaScript you can use from bellow code:

<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:

Radio1<input type="radio" id="TestRadio1" name="RadioName1" value="RadioButton1"  önclick="return YourFunctionName();" />





我希望它对你有所帮助。



I hope it's helpful for you.


这篇关于单选按钮上可见的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆