title: Jquery to enable and disable a Asp.net button
body: <p>I have a
  <code>&lt;asp:Button ID="BtnAddCart" runat="server" Text="Place Order" Width="147px" 
          onclick="BtnAddCart_Click" Enabled="false"/&gt;</code></p>
  
  <p>and a checkbox column and checkbox header on a gridview. 
  on the header you select the checkbox all items on the grid are selected. If you uncheck the header checkbox the items on the grid are un selected.</p>
  
  <p>here is the Jquery</p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          var chkBox = $("input[id$='ChkAll']");
          chkBox.click(
             function () {
                 $("#MainContent_ProductGrid INPUT[type='checkbox']")
               .attr('checked', chkBox
                .is(':checked'));
                 $("#MainContent_BtnAddCart INPUT[type='submit']").removeAttr('disabled');
             });
          // Uncheck      
          $("#MainContent_ProductGrid INPUT[type='checkbox']").click(
                      function (e) {
                          if (!$(this)[0].checked) {
                              chkBox.attr("checked", false);
                          }
                          $("#MainContent_BtnAddCart INPUT[type='submit']").attr('disabled', 'disabled');
  
                      });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>why is the button not getting enabled and disabled.</p>