Creating alternating row colors

Posted on 2007-11-14
Last Modified: 2009-03-20
MS Access
Classic ASP VBScript

Hello.  I have a standard DWMX Repeat Region on a table row.  How can I use Classic ASP VBScript to alternate the rows' colors for better visibility?

Thank you,
Question by:lshane
LVL 13

Accepted Solution

samic400 earned 250 total points
ID: 20287308
mSwitch = 0

do while not mRS.EOF
    if mSwitch = 0 then
         response.write "<tr><td style='background-color:#CCCCCC'>"
         mSwitch = 1
         response.write "<tr><td style='background-color:#FFFFFF'>"
         mSwitch = 0
     end if

LVL 25

Assisted Solution

imitchie earned 250 total points
ID: 20288152
row = 0
do while not mRS.EOF
      response.write "<tr class='row"&row&"'>"
      row = (row + 1) mod 2

and make sure your css has the classes tr.row0 and tr.row1

Author Comment

ID: 20293403
Thanks samic400 and imitchie.  I appreciate it.

That did the trick (A couple of different ways).

Thanks so much,

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Translate a cURL request to Classic ASP 4 347
Classic ASP + JS 4 68
Copy only dates 3 70
Auto Submit on dropdown box 14 32
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now