Show 20 records from table in a 4 x 5 grid not big column

Clay Willing
Clay Willing used Ask the Experts™
on
Hi all,

i wuold like to set a recordset to extract 2 fields from a table and instead of showing in a table with 2 columns and 10 rows, spread this across a 4 columns by 5 rows instead.

I dont know if the table can be created dynamically in this manner or by splitting into 2 tables side by side..

Any assistance greatly appreciated
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Developer & EE Moderator
Fellow 2018
Most Valuable Expert 2013
Commented:
Give this a try

<table width="500" border="0" cellspacing="0" cellpadding="1">
<%
counter=0
do until rs.eof
counter=counter+1
if counter=3 then
   response.write "</tr>"
   counter=1
end if
if counter=1 then
	response.write "<tr>"
end if
	response.write "<td>"&rs.fieldOne&"</td>"
	response.write "<td>"&rs.fieldTwo&"</td>"
rs.movenext
loop
if counter=1 then 'we have an odd amount of data so lets fill up the td's
	response.write "<td>&nbsp;</td><td>&nbsp;</td></tr>"
end if
%>
</table>

Open in new window

Clay WillingEng Ops Mgr

Author

Commented:
Going to take a while to merge that into where I am at the moment but makes sense.

Will let you know how I get on


Regards,
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
Another way to get the same thing without tables would be using div's.
<style type="text/css">
#td_container {
      width: 800px;
}
#td_container .td {
      float: left;
      width: 190px;
      margin-right: 10px;
}
</style>

<div id="td_container">
<%do until rs.eof%>
<div class="td"><%=rs.field1%></div>
<%
rs.movenext
loop
%>
</div>
Clay WillingEng Ops Mgr

Author

Commented:
Thanks guys, have to give it up for today.  Will give both a good bash tomorrow morning.  

FYI I am writing all my html in Notepad and I am a bit new at the htm coding and havent used divs before or asp yet.  I had created my code from within access previously so it was easy to get the data out.

Check back tomoorow,

C
Clay WillingEng Ops Mgr

Author

Commented:
Gave me the prompt to use as abasis for my solution

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial