Asp.net如何用RadioButton控件Button控件是否可用?求无刷新的
当选择RadioButton1(Checked)时候Button可点击,为可用状态(Enabled)
如选择RadioButton2(Checked)时候Button不可点击,为不可用状态(Enabled)
要无刷新的
谢谢!
Asp.net如何用RadioButton控件Button控件是否可用?求无刷新的
当选择RadioButton1(Checked)时候Button可点击,为可用状态(Enabled)
如选择RadioButton2(Checked)时候Button不可点击,为不可用状态(Enabled)
要无刷新的
谢谢!
RadioButton控件
单选按钮只允许用户从几个选项中选择一项。
属性:
1、AutoPostBack属性:用于设置当单击RadioButton控件时,是否自动回送到服务器。True时,表示回送;False时(默认)时,表示不回送。
2、Checked属性:用于获取或设置单选按钮的选中状态。属性值为为布尔型值。True时,表示选中;False时(默认)时,表不选中。
3、Text属性:用于获取或设置单选按钮的文本。
4、TextAlign属性:用于指定单选按钮显示文本的显示位置。Right(默认)时,文本显示在单选按钮的右边;当属性为Left时,文本显示在单选按钮的左边。
事件:
Checkedchange事件:当向服务器回送时,如果checked属性值发生了变化,将引发事件。
示例如下:
[code="java"]
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.Items[0].Selected)
{
Button1.Enabled =true;
}
}
protected void RadioButtonList2_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList2.Items[0].Selected)
{
Button1.Enabled =false;}
}把RadioButtonList的AutoPostBack属性改为True
[/code]