I set 3 repeated columns, I want to use different background color for each repeated column, please share if you have any idea about how I can achieve this.
Below is my RadioButtonList
code
<asp:RadioButtonList ID="rblTimeSlot" runat="server" RepeatColumns="3" RepeatLayout="Table" AutoPostBack="False" CellPadding="10" CellSpacing="2" Font-Bold="False"></asp:RadioButtonList>
The item list is loading from Database on another event.
Thanks in advance.
Use CSS nth-child
(>=IE9):
#rblTimeSlot tr:nth-child(even)
{
background-color:aqua;
}
Or jquery:
$("#rblTimeSlot tr:even").css("background-color","aqua");
If you want to do the same for columns, use this slightly changed css:
#rblTimeSlot tr > td:nth-child(even)
{
background-color:aqua;
}
Or jquery:
$("#rblTimeSlot tr>td:even").css("background-color","aqua");