This article demonstrate how to set alternate row background colors for SSRS table report.
As you can see, here we have a sample report name RptProductDetails, and you can see the background color of report is white, or no color.
Setting alternate row colors
In order to set a alternate row colors, first open then properties window as shown below.
In case if you have not already opened a properties window yet, then you can either go to View menu and select Properties Window or just press F4.
After that, select a data row in report, and then go to properties window and find Fill property, and inside Fill property expand BackgroundColor dropdown.
Once you click on BackgroundColor dropdown, you will see a color window opens also you will notice that the background color is set to No Color which means there is no color for the background. In case, if you want to specify same color for all rows then you can select any color from color window, but here we want to give alternate row color for report, so click on Expression link.
Once you click on Expression link, a Expression Dialog box appears as shown below.
Now we will provide a expression to set background color for alternate rows.
Write the below expression in the expression window.
=IIF(ROWNUMBER(NOTHING) MOD 2, "LIGHTPINK", "WHITE")
Here we have used a ROWNUMBER function, which generates the row number for each row. So the expression will check if the row numbers are odd then the background color will be light pink while the background color is white for even row numbers.
Once you done with this, just click on Ok button to close the Expression Dialog box.
After that go to preview page to see how does it look like, and you can see, now report has an alternate row colors.
2,908 total views, 6 views today