1..用 服务器端实现怎样实现??2.如果用 js实现呢?我知道一个
        function checkThisTextbox()
        {
if   (document.all("checkthis").checked==true)     
  {   
      document.all("text1").disabled=false;   
  }   
  else   
  {   
      document.all("text1").disabled=true;   
  }   
但是 是不是在 body onload 调用这个 js?但是不成功的?谢谢了.

解决方案 »

  1.   

    肯定要用客户端脚本实现了。如果是嵌入到GridView里的CheckBox控制GridView里的TextBox的话。<INPUT type="checkbox" value="留言" onclick="abc(this)" id=<%# DataBinder.Eval(Container.DataItem, "ID") %>><INPUT type="textbox" id=<%# DataBinder.Eval(Container.DataItem, "ID") %>function abc(obj)
    {
    document.getElementById(obj.id).disabled=true; 
    }
      

  2.   

    错了<INPUT type="textbox" id=1<%# DataBinder.Eval(Container.DataItem, "ID") %>function abc(obj)
    {
    document.getElementById("1"+obj.id).disabled=true; 
    }
      

  3.   

    这个完全可以用js来实现阿在gridview的rowdatabound事件里面
    CheckBox chk= (CheckBox)e.Row.FindControl("CheckBox1");
    TextBox tb1 = (TextBox)e.Row.FindControl("TextBox1");chk.attributes.add("onclick","checkThisTextbox('"+chk.ClientID+"','"+tb1.ClientID+"');");
      

  4.   

    function checkThisTextbox(chkid,tbid)
            {
      if(document.getElementById(chkid).checked==true)     
      {   
          document.getElementById(tbid).disabled=false;   
      }   
      else   
      {   
          document.getElementById(tbid).disabled=true;    
      }
      

  5.   

    我用上面的,總是出錯呀。
     chk.Attributes.Add("onclick", "checkThisTextbox(' " + chk.ClientID + " ',' " + tb1.ClientID + " ');");
    提示如下:
    Object reference not set to an instance of an object.