Monday 28 July 2014

Alternating background colors in Reporting Services

One common question from many of those who are relatively new to Microsoft SQL Server Reporting Services is how to alternate the background color of detail rows in a table data region.

Although I'm sure samples of this have been posted elsewhere on the Internet, I thought I'd share a common technique in the hopes that those searching for a solution will find it, either here or elsewhere.

Let's consider an example. We have an employee phone list report as shown below.

SSRS_alternating_bgcolor2-2008-08-19

To make the report a little easier to read horizontally, we'd like to change the background color of every other row. To do so, let's highlight the detail row of the data table in the layout tab.

SSRS_alternating_bgcolor3-2008-08-19

In the properties window, find the BackgroundColor property for the highlighted row and choose <Expression...>. Add the following conditional formatting statement in the Edit Expression window.

SSRS_alternating_bgcolor4-2008-08-19

Click Ok, and preview the report.

SSRS_alternating_bgcolor1-2008-08-19

And there you go, a report that alternates the background color for each row.

Regards,
Sathish

No comments:

Post a Comment