Zebra (alternating color) Tables in ASP.NET

This is just a small note to say that I love doing this:

<tr class='<%# ((IDataItemContainer)Container).DisplayIndex % 2 == 0 ? "CommonListRow" : "CommonListRowAlt"  %>'>

When using any type of ASP.Net repeating control (such as asp:Repeater). It is much more maintainable than copying and pasting code between the <ItemTemplate> and <AlternatingItemTemplate>.

Posted