Forums
This topic is locked
Displaying records horizontally
Posted 09 Nov 2005 22:06:05
1
has voted
09 Nov 2005 22:06:05 Javier Castro posted:
Does anyone know how to display records Horizontally on a page. I want to display 3 items in a row to a maximum of 9 items. If I apply the repeat region I get one column of all the records. Is there a way to acomplish this horizontal display? any samples out there.Thanks,
Javier
Replies
Replied 10 Nov 2005 00:01:40
10 Nov 2005 00:01:40 Dave Thomas replied:
here is some sample code. also search these forums and google, there is quite a bit of info out there, also some extensions if you do not like to code things.
<pre id=code><font face=courier size=2 id=code>
<%
DIM mySQL, objRS
mySQL = "SELECT * FROM tblData"
Set objRS = Server.CreateObject("ADODB.Recordset"
objRS.Open mySQL, objConn
DIM recCount
IF Not objRS.EOF THEN
Response.Write "<table width='100%'>"
recCount = 0
Do UNTIL objRS.EOF
IF recCount Mod 3 = 0 THEN
IF recCount <> 0 THEN
Response.Write "</tr>"
Response.Write "<tr><td>"&objRS("Item"&"</td>"
ELSE
Response.Write "<td>"&objRS("Item"&"</td>"
END IF
recCount = recCount + 1
objRS.MoveNext
Loop
Response.Write"</tr></table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
%>
</font id=code></pre id=code>
regards
Dave Thomas
<b>DMX Zone Manager</b>
<pre id=code><font face=courier size=2 id=code>
<%
DIM mySQL, objRS
mySQL = "SELECT * FROM tblData"
Set objRS = Server.CreateObject("ADODB.Recordset"
objRS.Open mySQL, objConn
DIM recCount
IF Not objRS.EOF THEN
Response.Write "<table width='100%'>"
recCount = 0
Do UNTIL objRS.EOF
IF recCount Mod 3 = 0 THEN
IF recCount <> 0 THEN
Response.Write "</tr>"
Response.Write "<tr><td>"&objRS("Item"&"</td>"
ELSE
Response.Write "<td>"&objRS("Item"&"</td>"
END IF
recCount = recCount + 1
objRS.MoveNext
Loop
Response.Write"</tr></table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
%>
</font id=code></pre id=code>
regards
Dave Thomas
<b>DMX Zone Manager</b>
Replied 10 Nov 2005 03:09:31
10 Nov 2005 03:09:31 Javier Castro replied:
Thanks Dave, I'll look into it.
Replied 10 Nov 2005 05:55:23
10 Nov 2005 05:55:23 Javier Castro replied:
Thanks again Dave. I got an extension from Tom Muck's website. It does the work for ASP, I also notice that he has developed similar extension for ASP.NET PHP JSP ColdFusion.
In case anyone is looking for something like this here is the address:
www.tom-muck.com/extensions/help/HorizontalLooper/
Cheers,
Javier
In case anyone is looking for something like this here is the address:
www.tom-muck.com/extensions/help/HorizontalLooper/
Cheers,
Javier