Expression in reports
Expression is a very interesting property in SSRS reports. It is mostly used to do customizations at runtime. Expressions are basically used to change report appearances and report content at runtime. Microsoft Visual Studio has some built-in functions that can be used in expressions. In this recipe, we will implement the most important feature of printing the alternate line in different colors.
How to do it…
In the template, select the DetailRowStyle | FieldValueStyle node.
For the Background Color property, choose the <Expression...> list:
The Edit Expression window will pop up.
Type the following expression in the Edit Expression window, as shown in the screenshot:
=iif(RowNumber(Nothing)mod 3, "#e0e0e0", "#ffe0c0")
Save the template and go back to the PktCustTransList report for a preview.
The report should now appear with a different color on every third line when previewed, as seen in the following screenshot:
How it works…
Expressions are a powerful means through...