Link to home
Start Free TrialLog in
Avatar of Victor  Charles
Victor CharlesFlag for United States of America

asked on

How to change odd rows color in detail section of MS Report

Hello,

I am using MS Reports with VS 2008 (VB.NET), created an .rdlc to run my reports, but would like to change the backgroud color of alternating rows, can that be done in MS Report? I don't see such properties.

Thanks,

Victor
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

It is very simple.

If you click on the field,
click on properties to your right,
click on background color,
select expression.

Then enter something like this:

=IIf(RowNumber(Nothing) Mod 2 = 0, "Transparent", "gainsboro")

Replace transparent and gainsboro with your own favorite colors.
From what I know About MS report. it's just a report viewer. To create A report or change You require one of the microsoft database applications. Either access or SQL server
Avatar of Victor  Charles

ASKER

Thanks, but I tried the suggestions in the links but it still doesn't work. Do you have another source I can look into?

Victor
ASKER CERTIFIED SOLUTION
Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did you try all the different approaches in the link?
Thanks for the snapshot, It's hard to see itt because it is not very clear, but when I enter the code you provided, the background color of the entie table becomes (Red) the color of my second "color" variable. I would like it the be red only when the row is an even number and silver when the row is an odd number. Below is the code in the properties windows for Background color of the table object.

= IFF (RowNumber(Nothing) Mod 2 = 0, "Silver", "Red")

Thanks,

Victor
I didn't try the vbscript approach.
Did you click the screenshot to open it?

Opening it makes it bigger and easier to see.

Just follow it and you click on the same box that I click on and you get same result.
We are getting closer, It works for a partricular column but I need to work for  all the columns in the even or odd rows. Thanks.
I think this is field specific so you have to perform this for each column.
Yes, that is true. In othe words, go through each column to use same expression.
Got it. Thanks.
Thank You!