Friday, 24 July 2015

Razor syntax is loop odd or even

I had to render a table of data today, and alternate classes on the rows. Here's the Razor:
tr class="@(rowCounter%2 == 0 ? "even" : "odd")"

No comments:

Post a Comment

Comments are moderated, so you'll have to wait a little bit before they appear!