Reputation: 2041
How do I specify the text color of a ListItem in the following code? Thanks.
<asp:CheckBoxList id="check1" AutoPostBack="True"
TextAlign="Right" OnSelectedIndexChanged="Check"
runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
</asp:CheckBoxList>
Upvotes: 0
Views: 6605
Reputation: 13599
try something like
<asp:ListItem style="color:blue">Item 1</asp:ListItem>
Upvotes: 3
Reputation: 17049
COLD TOLD's answer looks good, however if you need to specify the colour for all the items do this instead:
<head runat="server">
<title></title>
<style type="text/css">
.checkboxList label
{
color:Red;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBoxList CssClass="checkboxList" ID="check1" AutoPostBack="True" TextAlign="Right"
runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
</asp:CheckBoxList>
</div>
</form>
</body>
Upvotes: 1