在RadioButtonList选中固定项触发事件

来源:百度知道 编辑:UC知道 时间:2024/05/15 05:25:10
我有一个RadioButtonList 项为“0”“1”
我想当我选“1”时能即时显示另一个RadioButtonList供进一步选择,而选“0”则无次选项
第二个RadioButtonList就在第一个旁边,visible属性为false,当我一选中第一个的“1”时,立刻变成ture显示在旁边
谢谢各位老大不吝赐教
m(__)m

Radio里面的数据Value设置跟下面的SelectedValue相等就行了 像:<asp:ListItem Value="0">0</asp:ListItem>

protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedValue == "0")
{
RadioButtonList2.Visible = false;
}
if (RadioButtonList1.SelectedValue == "1")
{
RadioButtonList2.Visible = true;
}
}

AutoPostBack设为true