protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox2.Checked == true)
        {
            textbox1.Enabled = true;
        }
        else 
        {
            textbox1 = false;
        }
    }
textbox1的Enabled属性初始值设为false,为什么选中CheckBox2没有反应,textbox1也不能输入

解决方案 »

  1.   

    CheckBox2的Autopostback有没有设为true
      

  2.   

    textbox1 = false;这句是错的!!!!!!!!
      

  3.   

    楼上说的没错。难道你的VS没报错??
     此消息通过 【CSDN论坛 Winform测试版】 回复!
      

  4.   

    干嘛不直接用js控件,你这种写法需要页面刷新呢,
    在checkbox的onClientCick中调用jsdocument.getElementByID("<%=textbox1.ClientID%>").style.display="none";
      

  5.   

    不好意思写错了textbox1.Enabled =false,这没问题