asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search





Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Code Samples
Components
Tools
New
Free
Downloads
Vendors
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

In response to Which Rows are Odd and Even?, three readers have come up with alternate solutions to Bruce Strickland's green-bar paper report look-a-like project:

The way I decide which row is even or not is very simple. This method is dated way back when computing power was a wee bit small. This method only uses subtraction, which is a very easy computation.


   ' Initialize.
   IsThisAOddRow = 2
   <loop>
      IsThisAOddRow = 3 - IsThisAOddRow
      if IsThisAOddRow = 1 then
        <Odd row>
      else
         <Even row>
      end if
   <end loop>

The variable "IsThisAOddRow" will change between 1 and 2, therefore is it very easy to decide which kind of row you are working with.

Submitted by Jesper Partoft

####################


If countTr Mod 2 <> 0 Then
        Response.Write "<TR BGCOLOR=#FFAAAA>"
Else
        Response.Write "<TR BGCOLOR=#FFFFFF>"
End If

Submitted by Pete Ramos

####################


counter = 0

Do while not oRs.eof
        counter = counter + 1

        if counter MOD 2 = 1 then
                bgcolor = "#F5F5F5"
        else
                bgcolor = "White"
        end if

        response.write "<tr bgcolor=" & bgcolor & "><td>Information goes
here</td></tr>"
        oRs.movenext
loop

Submitted by Jonathan Kretzmer



email this code sample to a colleague




Support the Active Server Industry


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers