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

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: 1/15/2005 4:51:56 AM
Comment:
Great! What simple real way of teaching.
Great
Many thanks to Mr. Author!

Product Spotlight
Product Spotlight 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Ads Powered by Lake Quincy Media
Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 8/22/2008 12:38:36 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search