By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,375 Members | 3,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,375 IT Pros & Developers. It's quick & easy.

Code for alternating colored rows.

P: n/a
Not sure if any one can help but I'm loading data into a table that
I've like to alternate the background color of the rows (White then
pink). Can someone tell me what I need to add to do this?
================================================== ====
While Not rsData.EOF

response.write "<tr><td width=225 align=left><font size=1>"
response.Write rsData("NAME")
response.Write "</font></td>"
response.write "<td width=225 align=left><font size=1>"
response.Write rsData("ADDRESS")
response.Write "</font></td>"
response.write "<td width=225 align=left><font size=1>"
response.Write rsData("PHONE")
response.Write "</font></td></tr>"

rsData.MoveNext

WEnd
================================================== =====

Thanks!!

Jun 12 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Dim b
b = True
While Not rsData.EOF
If b Then
Response.Write "<tr style=""background-color: #codeforpink"">"
Else
Response.Write "<tr style=""background-color: #ffffff;"">"
End If
b = Not b
Response.Write "<td>........"
'...code
Response.Write "</tr>"
rsData.MoveNext
Wend
%>

While Not rsData.EOF

response.write "<tr><td width=225 align=left><font size=1>"
response.Write rsData("NAME")
response.Write "</font></td>"
response.write "<td width=225 align=left><font size=1>"
response.Write rsData("ADDRESS")
response.Write "</font></td>"
response.write "<td width=225 align=left><font size=1>"
response.Write rsData("PHONE")
response.Write "</font></td></tr>"

rsData.MoveNext

WEnd
<cr******@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
Not sure if any one can help but I'm loading data into a table that
I've like to alternate the background color of the rows (White then
pink). Can someone tell me what I need to add to do this?
================================================== ====
While Not rsData.EOF

response.write "<tr><td width=225 align=left><font size=1>"
response.Write rsData("NAME")
response.Write "</font></td>"
response.write "<td width=225 align=left><font size=1>"
response.Write rsData("ADDRESS")
response.Write "</font></td>"
response.write "<td width=225 align=left><font size=1>"
response.Write rsData("PHONE")
response.Write "</font></td></tr>"

rsData.MoveNext

WEnd
================================================== =====

Thanks!!

Jun 12 '06 #2

P: n/a
First, stop using WHILE...WEND... use DO...LOOP instead. Also, you should
use CSS classes instead of deprecated tags like <font> but we can deal with
that in a client-side group. For now,


color = "red"
Do While Not rsData.EOF
If color = "red" Then
color = "blue"
Else
color = "red"
End If
Response.Write "<tr bgcolor='" & color & "'>"
Response.Write "other stuff"
rsData.MoveNext()
Loop

<cr******@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
Not sure if any one can help but I'm loading data into a table that
I've like to alternate the background color of the rows (White then
pink). Can someone tell me what I need to add to do this?
================================================== ====
While Not rsData.EOF

response.write "<tr><td width=225 align=left><font size=1>"
response.Write rsData("NAME")
response.Write "</font></td>"
response.write "<td width=225 align=left><font size=1>"
response.Write rsData("ADDRESS")
response.Write "</font></td>"
response.write "<td width=225 align=left><font size=1>"
response.Write rsData("PHONE")
response.Write "</font></td></tr>"

rsData.MoveNext

WEnd
================================================== =====

Thanks!!

Jun 12 '06 #3

P: n/a

cr******@gmail.com wrote:
Not sure if any one can help but I'm loading data into a table that
I've like to alternate the background color of the rows (White then
pink). Can someone tell me what I need to add to do this?
================================================== ====
While Not rsData.EOF

response.write "<tr><td width=225 align=left><font size=1>"
response.Write rsData("NAME")
response.Write "</font></td>"
response.write "<td width=225 align=left><font size=1>"
response.Write rsData("ADDRESS")
response.Write "</font></td>"
response.write "<td width=225 align=left><font size=1>"
response.Write rsData("PHONE")
response.Write "</font></td></tr>"

rsData.MoveNext

WEnd
================================================== =====

Thanks!!


Did you google?

http://www.google.co.uk/search?hl=en...e+Search&meta=

--Mike Brind

Jun 12 '06 #4

P: n/a
Thanks for the info folks. Good to know there's quick help out there.

Jun 12 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.