日期:2014-05-17  浏览次数:20392 次

RadioButton控件
比如现在有两个RadioButton控件id分别为r1,r2,并且有个各自的Text属性值,Checked都为false。如何实现点击r1,r2.Text立即变化为指定的其他值?

------解决方案--------------------

前台:   <asp:RadioButton ID="RadioButton1" runat="server" AutoPostBack="True" 
            oncheckedchanged="RadioButton1_CheckedChanged" />//注意设置AutoPostBack="True" 
        <asp:RadioButton ID="RadioButton2" runat="server" />
后台: 
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton2.Text = "点击变化的值!";
    }

------解决方案--------------------
重新新建一个项目试。以上代码是可行的。