title: enable textbox with checkbox checked with javascript
body: <p>HEllo - 
  I am trying to enable/disable textbox when checkbox is checked (enable) or unchecked (disable). 
  WIth the piece of code i have nothing is happening once the checkbox is checked/unchecked. 
  Here is what I have:</p>
  
  <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AssociationInfo.ascx.cs" Inherits="Administration.Modules.AssociationInfo" %&gt;
  &lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %&gt;
       &lt;script type="text/javascript" language="javascript"&gt;
          function enableTextBox() {
              window.onload = function () {
                  var check = document.getElementById("chkAssociation");
                  check.onchange = function () {
                      if (this.checked == true)
                          document.getElementById("txtAddress").disabled = false;
                      else
                          document.getElementById("txtAddress").disabled = true;
                  };
              };
          }
      &lt;/script&gt;
  
      &lt;div&gt;
      &lt;h2&gt;Association Info&lt;/h2&gt;
      &lt;br /&gt;
  
        &lt;asp:CheckBox Checked="false" ID="chkAssociation" runat="server" /&gt;&amp;nbsp;&amp;nbsp;
         &lt;asp:TextBox ID="txtAddress" Text="Test" runat="server" /&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>The code is in web user control. Could that be reason why is not working correctly?</p>
  
  <p>Thanks for helping</p>
  
  <p>Thanks everyone for the help in advance, Laziale</p>