ASP.NET Repeater Single and double line data color change example
- 2021-01-22 05:05:20
- OfStack
ItemCreated triggers the event by clicking Repeater in the foreground.
CS code:
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
if ((e.Item.ItemIndex + 1) % 2 == 0)
{
((HtmlTableRow)e.Item.FindControl("row2")).BgColor = "#FFE6E6";
}
else
{
((HtmlTableRow)e.Item.FindControl("row2")).BgColor = "#e8f5fd";
}
}