Even Odd Row Samples


This sample demonstrates how you can give your tables an even and odd row color by using the built-in {ds_EvenOddRow} data reference inside a class attribute. The data reference is the value of a class attribute: 'class="{ds_EvenOddRow}"'. When the region processes, it will evaluate the number of the row being written and will replace the data reference with the word 'even' or 'odd'. Define CSS classes with these names and the class is applied to the element, and therefore alternating classes are applied to the element. The classes can do whatever you wish to do with CSS. Alternating row colors is just one common scenario.

Row # Last Name First Name
{ds_RowNumberPlus1} {lastname} {firstname}

The following samples demonstrate how to do the same thing with the spry:even and spry:odd attributes. These were introduced in Spry Prerelease 1.4. They can be more flexible because you don't have to use them together and the class names can be whatever you wish.

This sample uses both spry:even and spry:odd attributes:

Row # Last Name First Name
{ds_RowNumberPlus1} {lastname} {firstname}

This sample uses only the spry:even attribute but specifies the data set to use when determining the row number to use when determining "even-ness", and a custom CSS class name which colors the even rows differently from what is used in the tables above:

Row # Last Name First Name
{ds_RowNumberPlus1} {lastname} {firstname}