如何解决我的错误

时间:2011-05-06 04:44:01

标签: asp.net

我单击单选按钮1禁用文本框。单选按钮2单击

文本框启用但首先我点击单选按钮2然后我点击单选按钮1不禁用文本框如何解决问题 enter code here

public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
               txtrb.Enabled = true;
            }

        }


    protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
    {
        {
            if (RadioButton1.Enabled == true )
            {
                txtrb.Enabled = false ;
            }

        }
    }

    protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
    {
        if (RadioButton2.Enabled == true)
        {
            txtrb.Enabled = true ;
        }


    }
}

}

1 个答案:

答案 0 :(得分:0)

我认为你必须检查

if(RadioButton1。选中 == true)和if(RadioButton2。选中 == true)