使用asp.net的C#中的单选按钮 [英] radio button in c# using asp.net
本文介绍了使用asp.net的C#中的单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题是有两个单选按钮.当我选中一个单选按钮时,它应该显示一些文本字段,而其他字段应该是不可见的.如果我单击另一个单选按钮,则不可见的字段应该是可见的.请找到一个解决方案.
my question there are two radio buttons .when i check one radio button it should shows some of the text fields and other fiels should be invisible.if i click another radio button the invisible field should visible.plz find a solution.i can''t do this.what is the code and logic written is aspx.cs page?
推荐答案
有一个名为"Checked"的事件使用它
http://www.w3schools.com/aspnet/control_radiobutton.asp [
There is an event called "Checked" use it
http://www.w3schools.com/aspnet/control_radiobutton.asp[^]
if(chkRadio1.checked == true ){
txttextBox.visible = true;
}
其他
{
txttextBox.visible = false;
}
if (chkRadio1.checked == true) {
txttextBox.visible=true;
}
else
{
txttextBox.visible=false;
}
您应该对单选按钮进行分组,然后在单击事件方法上根据需要将display或visible属性设置为true或false.
Hi,
You should group both the radio button and then on click event method you can set display or visible property to true or false as per your need.
这篇关于使用asp.net的C#中的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文