|
|
 |
Alternate color for RS looping with For Next
eeswar | Posted 4:01pm 16. December 2010 Server Time |
Hi,
i have a comments section for my webpage with alternate color for recordsets... <% i=0 Do While Not Rs.EOF if i mod 2=0 then bgcolor="#ffffff" else bgcolor="#f5f5f5" end if response.write "<div style="background:"&bgcolor&">"&comments&"</div>" i=i+1 Rs.movenext Loop %>
above code works fine..but the problem is i have added recordset paging to my comments page after that i can't figure out how to get alternate color for recordsets...if i use do while not rs.eof like above code it displays entire records thus paging is useless...if i use if not rs.eof i can't get the bgcolor working....please help me with the below code!
<% For intRec=1 To rs.PageSize i=0 if i mod 2=0 then bgcolor="#ffffff" else bgcolor="#f6f6f6" end If If Not rs.EOF Then
i=0 if i mod 2=0 then bgcolor="#ffffff" else bgcolor="#f6f6f6" end If response.write "<div style="background:"&bgcolor&">"&comments&"</div>" i=i+1 RS.MoveNext end if Next %>
thanks, gnan
|
lloyd | Posted 7:52am 25. December 2010 Server Time |
Hiya, Before you ask - i work Christmas day. In the original code, stick i=i+1 after the line rs.Movenext.
I think that should work for alternate row colouring. Hope it does!
Merry Christmas.
eeswar | Posted 4:11pm 3. January 2011 Server Time |
lloyd,
using case instead of looping worked for me...
tnx for replying.. Happy new year
Show all replies to 'Alternate color for RS looping with For Next'
|
This post have been closed for new replies
|
|
|
|
 |
|