Click here to Skip to main content
Click here to Skip to main content
Go to top

Alternate Rows Coloring in SQL Reporting

, 16 Feb 2005
Rate this:
Please Sign up or sign in to vote.
To change the row colors in reports.

Introduction

Like every other report has some or the other way to make it look beautiful, SQL Reporting also has some good features, but here I will be just showing how to make the color change for alternate rows.

Purpose

Generally, with detailed reports, if the look is made a little good, then everyone loves it.

Using the code

There is not much coding to be done, just a single line of code will solve this issue. Get the DataSet name after you have configured the DataSet.

When you use the table in your report, the table, by default, shows three rows, the header, detail and the footer. In this section, we will delete the footer row. Select the detailed row, right click, and select Properties.

In the Properties page, select the BackgroundColor property, pull down the dropdown, and select <Expression>.

On the left pane of the Edit Expression, select Constants (which is selected by default), and in the Expression pane, type the following line and click OK:

=IIF(RowNumber("NWDataSet") Mod 2, "Gainsboro", "White")
// NWDataSet is the Dataset name.

That's it! Click the preview and you are good to go..

Points of Interest

SQL Reporting tool provides a lot of great other features, like if you have a detailed report of employees salary list and you want to highlight only rows whose salary is high, you could do it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Jay Kulaindevelu
Web Developer
United States United States
I'm a .Net Programmer/Web Developer, mostly working on ASP.Net C# and VB.Net,Oracle,SQL server 2000.

Comments and Discussions

 
GeneralReceiving an error Pinmemberkakko722-May-05 7:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 17 Feb 2005
Article Copyright 2005 by Jay Kulaindevelu
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid