I’m using a parametized query to get records that will display as a grid of products on a page. My design has 4 products listed in each row, but i’d like to apply a class to every 4th item, so that I can clear any margins/padding.
Here is my current code;
<%
Set conn = Server.CreateObject("ADODB.connection")
conn.Open Application("database")
Set cmd = Server.CreateObject("ADODB.command")
With cmd
.ActiveConnection = conn
.CommandType = adCmdStoredProc
.CommandText = "prc_getCollection"
.Parameters.Append .CreateParameter("@LabelID", adInteger, adParamInput,, 5)
Set rsCollection = .Execute
End With
%>
<% While Not rsCollection.EOF %>
<li>Product Name</li>
<%
rsCollection.MoveNext
Wend
rsCollection.Close()
Set rsCollection = Nothing
%>
If anyone knows how I can apply a “last” class to every 4th
Thank you.
It’s a long time since I have done any classic asp so the syntax may be slightly off. The usual approach is to increment a counter and use the modulus operator to determine if you are on a row number that is an exact multiple of 4.