title: ASP.NET - Setting CssClass of a CheckBox
body: <p>The following code</p>
  
  <pre><code>((CheckBox)e.Row.FindControl("exportCb")).CssClass = "enabledExport";
  </code></pre>
  
  <p>Creates html</p>
  
  <pre><code>&lt;span class="enabledExport"&gt;&lt;input id="_ctl0_ContentPlaceHolder1_gridviewName__ctl2_exportCb" type="checkbox" name="_ctl0:ContentPlaceHolder1:gridviewName:_ctl2:exportCb" /&gt;&lt;/span&gt;
  </code></pre>
  
  <p>For the asp.net gridview column</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Export"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:CheckBox runat="server" ID="exportCb"/&gt;        
                          &lt;/ItemTemplate&gt;
                          &lt;ItemStyle/&gt;
                      &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>I need to use jquery</p>
  
  <pre><code>$('.enabledExport').toggle()
  </code></pre>
  
  <p>to check/uncheck (as a toggle) the checkboxes.  Because the <code>CssClass</code> is marked on the <code>&lt;span&gt;</code> the code is going to try to toggle a <code>&lt;span&gt;</code> instead of the <code>&lt;input&gt;</code>.  How can I fix this?  </p>
  
  <p>I don't mind if the solution is on jquery or asp.net side as long as it works.  I'd love it if the code just marked the input like its supposed to...</p>