日期:2014-05-18  浏览次数:20502 次

RadioButton点击后显示隐藏的panel
有两个服务器端单选按钮控件,两个panel控件,在页面加载时只显示单选按钮,点R1时,panel1显示,点R2时,panel2显示,请问这个应该是在单选按钮的哪个事件下进行

------解决方案--------------------
可以用RadioButtonlist。如果用它,就在它的RadioButton1_CheckedChanged 中写。

------解决方案--------------------
也可以在两个按钮里都写事件处理函数
------解决方案--------------------
首先在pag——load那两panel隐藏
然后把两RadioButtonlist的autopostback设置为true
之后在rn1的RadioButton1_CheckedChanged事件写上 panel1显示panel2隐藏
rn2的RadioButton1_CheckedChanged事件写上 panel2显示 panel隐藏
------解决方案--------------------
rn1_CheckedChanged事件中
{
this.Panel1.Visiable = True;
this.Panel2.Visiable = False;
}
rn2_CheckedChanged事件中
{
this.Panel1.Visiable = False;
this.Panel2.Visiable = True;
}
别忘了给rn1和rn2命名为同一GroupName
另外,用RadioButtonlist也可以。