SSRS Alternating Backround Colors


4/26/2010 4:34:30 PM

One common behavior that people want to implement on their SSRS Reports is alternating background colors for a table. This makes the report rows easier to read and allows the user to find the data that they are looking for quickly.

Below is an example of tabular data taken from the Adventure Works DW 2008 Cubes: No Rows Affected

If we want to make the report a little easier to read we need to change the background color of the rows.

  1. In design mode click on the entire row of the data table you can see in the Properties window a Background color property.
  2. Click on Expression to add an Expression to this property.
    SSRS Expression

Enter:
=IIF(RowNumber(Nothing) Mod 2, "Silver" , "#FFFFFF")

You can see above that I used Silver and #FFFFFF. This is just to show you that you can use hex values for the colors as well. It is not constrained to the colors that are given.

This will produce : Final Result

Which is exaclty what we are looking to achieve. This has made the horizontal background colors alternate so that the report becomes easier to read.