You can set the background color individually for each cell, but a much better solution is to create two classes with different styles. Your code will need to assign the right class to each row:
In the above code, M.RecCount % 2 will return 0 for even rows and 1 for odd rows. The resulting HTML code will look something like this:
Sent by Larry Zhang on 11/13/2006 08:29:25 AM:
Thank you for your reply.
What I want to achieve is to have different background color for each row of records. Now every line is white. I wish to display them as white, yellow, white , yellow, alternatively.
Using your code, every line will be yellow. Thanks again.
Sent by FoxWeb Support on 11/13/2006 07:06:55 AM:
Please try to be more specific in your questions. What do you mean by "grids"? Are you referring to HTML tables? Also, which color are you trying to change, the cell background color, the text color of the content, or the border color? I will assume that you are indeed referring to HTML tables. You can change all three colors above using regular HTML code, like this:
However, a much better technique is to use cascading stylesheets (CSS). For information on CSS you will need to consult an appropriate book, or on line reference.
Sent by Larry Zhang on 11/10/2006 08:25:41 AM:
How to display grids in alternative colors?
Funny the subject field above is too short and can not hold so many characters.
It might be a HTML question. I do appreciate it if anyone can give an answer. Thanks.