Add alternating row color to SQL Server Reporting services report

Michael Haren picture Michael Haren · Sep 4, 2008 · Viewed 277.1k times · Source

How do you shade alternating rows in a SQL Server Reporting Services report?


Edit: There are a bunch of good answers listed below--from quick and simple to complex and comprehensive. Alas, I can choose only one...

Answer

Michael Haren picture Michael Haren · Sep 4, 2008

Go to the table row's BackgroundColor property and choose "Expression..."

Use this expression:

= IIf(RowNumber(Nothing) Mod 2 = 0, "Silver", "Transparent")

This trick can be applied to many areas of the report.

And in .NET 3.5+ You could use:

= If(RowNumber(Nothing) Mod 2 = 0, "Silver", "Transparent")

Not looking for rep--I just researched this question myself and thought I'd share.