title: remove onClick attribute in code behind
body: <p>a checkbox on my page has the onclick event to enable a button when it is checked, and disable it when it is not checked. sometimes I need the button to be disabled completely, but I don't want it to be invisible.</p>
  
  <p>the checkbox looks like this:</p>
  
  <pre><code>&lt;asp:CheckBox ID="cb_start" runat="server" onClick="cb_start_click()"/&gt;
  &lt;script&gt;
      var cb = document.getElementById("ContentPlaceHolder1_cb_start");
      var btn = document.getElementById("ContentPlaceHolder1_btn_start");
      function cb_start_click(){
          btn.disabled = !cb.checked;
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>In the code behind I tried this, but it did not work:</p>
  
  <pre><code>cb_start.Attributes.Remove("onClick");
  if (somecase) cb_start.Attributes.Add("onClick", "cb_start_click()");
  </code></pre>