The following code
((CheckBox)e.Row.FindControl("exportCb")).CssClass = "enabledExport";
Creates html
<span class="enabledExport"><input id="_ctl0_ContentPlaceHolder1_gridviewName__ctl2_exportCb" type="checkbox" name="_ctl0:ContentPlaceHolder1:gridviewName:_ctl2:exportCb" /></span>
For the asp.net gridview column
<asp:TemplateField HeaderText="Export">
<ItemTemplate>
<asp:CheckBox runat="server" ID="exportCb"/>
</ItemTemplate>
<ItemStyle/>
</asp:TemplateField>
I need to use jquery
$('.enabledExport').toggle()
to check/uncheck (as a toggle) the checkboxes. Because the CssClass is marked on the <span> the code is going to try to toggle a <span> instead of the <input>. How can I fix this?
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…
If you’re trying to show/hide the checkbox you could do this:
but what I think you’re trying to do is: