Basic Databases Part 2
page 4 of 5
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 24456/ 62

Step 6 : Alternating Colour

Step 6 : Alternating color

Ok, that may be fine for you, but I like to alternate my color. This requires a bit more work. We have to put 2 rows of data in 1 While statement and do the row color at the same time.

<table border=1><tr><td><strong>Addresses</strong></td><td><strong>City</strong></tr>
<% While Not RecordSet1.EOF
Response.Write("<tr bgcolor=gray><td>") 'Put in a bgcolor for the 1st row
%><%=(Recordset1.Fields.Item("Address").Value)%><%
Response.Write("</td><td>")
%><%=(Recordset1.Fields.Item("City").Value)%><%
RecordSet1.MoveNext
'From here down, copy and paste from above.
Response.Write("<tr bgcolor=silver><td>") 'Change bgcolor for the 2nd row
%><%=(Recordset1.Fields.Item("Address").Value)%><%
Response.Write("</td><td>")
%><%=(Recordset1.Fields.Item("City").Value)%><%
RecordSet1.MoveNext
Wend %></td></tr></table>

Simple copy and paste from the comment but I change the row bgcolor on the second one. And this looks like this:


View Entire Article

User Comments

Title: Real   
Name: Rizwan
Date: 2005-01-15 4:51:56 AM
Comment:
Great! What simple real way of teaching.
Great
Many thanks to Mr. Author!

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-06-25 12:22:09 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search