Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Alternating Row Color Question - receiving error :(

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-17-04, 15:42
RhythmAddict RhythmAddict is offline
Registered User
 
Join Date: Dec 2003
Posts: 148
Alternating Row Color Question - receiving error :(

Hi everyone. I'm tryin to set up some alternating row colors - something that is normally painless however I am having some kind of issue with the nesting of conditional statements I believe. I get an expected statement error on line 252 (which has asterisks in front of it in the code below)
Any help would be appreciated - the code is below.....




<html>
<head>
<title>Tool</title>

</style>
</head>
<%

dim row, bgcolor
row = 1

do until RS.EOF
if (row mod 2) = 1 then
bgcolor = "#FFFFFF" 'Main Color
else
bgcolor = "#CCCCCC" 'Alternate Color
end if

row = row + 1


%>
<body>


<img SRC="images/commstore_banner.gif" WIDTH="600" HEIGHT="50">
<hr size="2" color="Red">[<a HREF="http://northeast.corp.bam.com/commstore/reports.htm">Northeast Area Automated Sales Reporting</a>]<p>

<a HREF="query.asp">New Search</a><p>

<%=fieldFound%><p>

<% If RS.EOF Then
Response.Write "<FONT face=Arial color=Red><B>No Results</B></FONT>"
Else
RS.MoveFirst
count = 0 %>

<table width="750" border="1" cellspacing="1" cellpadding="3" bgcolor="Red">
<tr bgcolor="White">
<td class="Main" align="center">Transaction
</td>
<td class="Main" align="center">Customer
ID</td>
<td class="Main" align="center">Line #</td>
<td class="Main" align="center">Transaction
Type</td>
<td class="Main" align="center">Number</td>
<td class="Main" align="center">Sales Rep
ID</td>
<td class="Main" align="center">Price Plan
Code</td>
<td class="Main" align="center">Churn Flag</td>
<td class="Main" align="center">Outlet ID</td>
</tr>


<%Do Until RS.EOF%>
<tr bgcolor=<%=bgcolor%>>
<td class="Data"><%=RS.Fields("field1")%></td>
<td class="Data"><%=RS.Fields("field2")%></td>
<td class="Data"><%=RS.Fields("field3")%></td>
<td class="Data"><%=RS.Fields("field4")%></td>
<td class="Data"><%=RS.Fields("field5")%></td>
<td class="Data"><%=RS.Fields("field6")%></td>
<td class="Data"><%=RS.Fields("field7")%></td>
<td class="Data"><%=RS.Fields("field7")%></td>
<td class="Data"><%=RS.Fields("field7")%></td>
</tr>



<% count = count + 1
RS.MoveNext
Loop %>
</table>



<% End If
%>

</body>
</html>

**************the line with "end if" on it is number 252
<%
End If
%>
Reply With Quote
  #2 (permalink)  
Old 06-17-04, 22:14
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
Remove this line....

do until RS.EOF

and move this set of lines into your other loop further down....

if (row mod 2) = 1 then
bgcolor = "#FFFFFF" 'Main Color
else
bgcolor = "#CCCCCC" 'Alternate Color
end if

Also, you could make this a little better if you drop the whole row incrementing and do something like...

bgcolor = ""
if bgcolor = "#CCCCCC" then
bgcolor = "#FFFFFF" 'Main Color
else
bgcolor = "#CCCCCC" 'Alternate Color
end if

Mean you don't have the unnecessary overhead of the row variable that you used to.....
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On