In this article we will show you, How to add Alternative Row Color to SSRS Report. This is one of the Frequently asked question by the users. So, here we will show you the step by step approach to add Alternative Row Colors to SSRS Report using an Expression with example.
We are going to use below shown Data Set to explain the same. Please refer Embedded Data Source and Dataset articles to understand the steps involved in creating Embedded Data Source, and Dataset that we used for this report.
and the Custom SQL query that we used in the above Data set is:
-- Display Alternative Row Colors in SSRS Report
SELECT [FirstName] + ' ' + [LastName] AS FullName
Data written by the above query is:
Add Alternative Row Color to SSRS Report
We are going to use the previously designed report as we shown below. Please SSRS Table Report, Format Table Report in SSRS article to understand the steps involved in creating Table Report & format, and Add headers and Footer to SSRS Report article for adding Page headers, and footers.
Let me show you the Report Preview.
After you select the details row, you have an option called Background color in the properties pane. You can use all the predefined color, if you want to make the standard color for all the rows returned by the report. Here our task is to add alternative row color, which means we have to use some condition to check for alternative rows.
To do so, Please click on the Expression hyperlink under the background Color property.
Once you click on the Expression hyperlink, a new window called the Expression will be opened. Use this expression window to check for the alternative rows.
Within the Expression, we are going to use the IIF condition to check whether the row number is even or not. If it is even then Pale Turquoise, otherwise Plum.
=IIF(RowNumber(Nothing) MOD 2 = 0, "PaleTurquoise", "Plum")
Once you are done, Click OK to close the window
As you can see that our report preview is displaying the specified colors as the alternative row colors
Thank You for Visiting Our Blog