title: C# javascript enable/disable checkboxes
body: <p>I have some checkboxes dynamically created in C# codebehind. Let's say two columns. This works fine.</p>
  
  <p>I want the checkboxes in the left column to enable/disable those in the right upon check.  I do this by attaching attributes to the checkboxes in codebehind that run javascript to do the enabling/disabling. This works great.</p>
  
  <p>Here's the javascript:</p>
  
  <pre><code>function SetPrimaryStatus(target, senders) {
      var dis = "disable";
      var arr = senders.split(",");
      for (var i = 0; i &lt; arr.length; i++) {
          if (document.getElementById(arr[i]).checked == true) {
              dis = "";
              break;
          }
      }
      document.getElementById(target).disabled = dis;
      if (dis == "disable") document.getElementById(target).checked = false;
  }
  </code></pre>
  
  <p>I thought I was home free...I just have to disable the right column checkboxes upon creation in the codebehind (<code>CheckBox.Enabled = false;</code>).  Ok.</p>
  
  <p>For whatever reason now, when I check the left checkboxes, the right ones do nothing.  I've set alerts in the javascript and they always come up...and things appear to be set like they should. When I remove the <code>CheckBox.Enabled = false;</code> in codebehind, it works again.</p>
  
  <p>In fact, I can start some of the left checkboxes with a check and the corresponding right checkbox I leave enabled. When I run the set(s) that starts enabled works perfect but the set(s) that start with the right checkbox disabled do not.</p>
  
  <p>Is there something other than Enabled that I should be setting in codebehind to start the checkboxes in a disabled state that the javascript can then change?  Is it a matter of true/false compared to "disable"?  I've tried both.</p>