how to add a style to items within a CheckBoxList?
Posted on 2006-10-21
I have a CheckBoxList to which I wish to add a specific style from the css page to format the text size.
How do I achieve this?
I hjave tried adding the attribute 'CssStyle="txtSmall"' to the tag such as <asp:CheckBoxList CssStyle="txtSize" id="lbCostCenter" Runat="server" AutoPostBack="True" RepeatColumns="2" RepeatDirection="Horizontal" width=100% />/>
But this does not work. It renders the page as <table id="lbCostCenter" class="txtSmall" border="0" style="width:100%;"> but the text for each CheckBox is the wrong size ie the css style is not applied.
If I try adding code to the cs page such as :
lbCostCenter.Attributes["CssClass"] = "txtSmall";
lbCostCenter.CssClass = "txtSmall";
but the result is exactly the same as the first attempt.
How do I force each <input ... />to read <input ... CssClass="txtSmall" />