I was recently working on creating a SSRS report in SQL Server 2008 which required alternating background colors. Initially it seemed a easy requirement but as the report got built out it had a row group and a column group which made the getting background colors tricky. Initially I went with the RowNumber and Running value functions, it did not get the required effect. In an earlier blog post i had mentioned the use of DENSE_RANK() function in a stored procedure to get the background color effect. I recently came across another approach which is using Group variables(I would like to acknowledge the MSDN forums and blogger's who have mentioned this approach), which works very well. First you would need a custom code function which would go in the Report Properties code section:
Public EvenRow as Boolean
Public Function AltRow() as Boolean
EvenRow = Not EvenRow
Once this is done, In the group properties (this would be the data point/column in the dataset for which we need the alternate row color), under variables create a variable called AltRowColor, in the value section call the function =Code.AltRow()
Select the whole row for which you need the alternate row color, in the background color property enter the following expression: =iif(Variables!AltRowColor.Value,"Gainsboro","White"). Once this is completed run the report you should see the alternate row colors. This was done in SSRS 2008 with the tablix control which has Row and Column Groups.