I need to manipulate the attributes of a label element inside an ASP.NET CheckBoxList control.  Each checkbox label needs to have a different class.  The best alternative I see is to apply the classes with jQuery after the fact.  Does anyone know a better method?
I found this post marginally helpful, however, adding an attribute to the list item only wraps the input element and the label element in a span tag with the denoted attributes. 
Variation of Billy's second answer, but without server side code:
Assign the class to checkboxlist itself
<asp:CheckBoxList runat="server" id="MyCBL" CssClass="MyClass"></asp:CheckBoxList>
Any CSS you apply to the parent element (in this case the checkboxlist, which renders as a table) can be passed to its child elements:
<style>
    .MyClass label {color: Blue}
    .MyClass input[type='checkbox'] {background-color: Red}
</style>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With