s
Contact Login Register
h M

Dynamic Views Alternate Row Colors

Author: Chad Nash/Friday, September 14, 2012/Categories: In The Flow

Rate this article:
No rating

Hello Everyone,

I have come up with a simple method in which you can apply Alternate Row colors to your Dynamic Views. Here’s an image of my Dynamic View:

DynamicView

 

This can only be accomplished when using Custom SQL as the Data Source of your Dynamic View. Here’s the SQL that’s being used in this Dynamic View:

select *, (CASE WHEN ABS(TemplateID) % 2 = 1 THEN '#F6F6F6' ELSE '#E8E8E8' END) As TheRowColor from Module_Templates

** The Highlighted section is the column that’s responsible for Alternating Colors.

Now that you’re returning this column in your Dynamic View you can use this token in your Dynamic Views Item Template.

You’ll want to assign “[therowcolor]” to the TR of your table.

 

For instance here’s the HTML that I used for my Dynamic View:

View my Template HTML

 

Leave a comment if you have any questions or like the blog.

 

-Ryan Bakerink

Number of views (168216)/Comments (-)

Tags:
blog comments powered by Disqus

Enter your email below AND grab your spot in our big giveaway!

The winner will receive the entire Data Springs Collection 7.0 - Designed to get your website up and running like a DNN superhero (spandex not included).

Subscribe