Skip to main content
Participating Frequently
April 19, 2007
Answered

Horziontal looper in columns

  • April 19, 2007
  • 1 reply
  • 305 views
Hi,
I need a repeat region to run in 2 or 3 columns, afaik the Tom Muck extension will only go
| 1 | 2 |
| 3 | 4 |
| 5 | 6 |
where as I need it to go
| 1 | 4 |
| 2 | 5 |
| 3 | 6 |
Does anyone know a workaround or alternative?
Thanks,
Mark.
This topic has been closed for replies.
Correct answer Newsgroup_User
funkster wrote:

> Hi,
> I need a repeat region to run in 2 or 3 columns, afaik the Tom Muck
> extension will only go
> | 1 | 2 |
> | 3 | 4 |
> | 5 | 6 |
> where as I need it to go
> | 1 | 4 |
> | 2 | 5 |
> | 3 | 6 |
> Does anyone know a workaround or alternative?
> Thanks,
> Mark.

I did exactly this in a three column table.

Count the number of records, divide by the required columns

repeat each record down on a new line - when you get to the division
spot enter the code for a new column and repeat.

<%
CT= Int(country_total)
CTS=Int(country_total)/3
CMS = CT + 1
CME = CTS*2
CRS = CME + 1

varRowCount = 0
Do While varRowCount < CT
Response.Write "<a href='hotel_city.asp?Country=" &
(country.Fields.Item("Country").Value) & "'>" &
(country.Fields.Item("CName").Value) & " Hotel</a><br>"
If varRowCount = Int(CTS) Then response.write "</td><td width='210'
valign='top'>"
If varRowCount = Int(CME) Then response.write "</td><td width='210'
valign='top'>"
Country.MoveNext
varRowCount = varRowCount + 1
Loop
%>

Crude but works and guaranteed to offend the CSS purists!

--
Buzby
There's nothing more dangerous than a resourceful idiot

1 reply

Newsgroup_UserCorrect answer
Inspiring
April 19, 2007
funkster wrote:

> Hi,
> I need a repeat region to run in 2 or 3 columns, afaik the Tom Muck
> extension will only go
> | 1 | 2 |
> | 3 | 4 |
> | 5 | 6 |
> where as I need it to go
> | 1 | 4 |
> | 2 | 5 |
> | 3 | 6 |
> Does anyone know a workaround or alternative?
> Thanks,
> Mark.

I did exactly this in a three column table.

Count the number of records, divide by the required columns

repeat each record down on a new line - when you get to the division
spot enter the code for a new column and repeat.

<%
CT= Int(country_total)
CTS=Int(country_total)/3
CMS = CT + 1
CME = CTS*2
CRS = CME + 1

varRowCount = 0
Do While varRowCount < CT
Response.Write "<a href='hotel_city.asp?Country=" &
(country.Fields.Item("Country").Value) & "'>" &
(country.Fields.Item("CName").Value) & " Hotel</a><br>"
If varRowCount = Int(CTS) Then response.write "</td><td width='210'
valign='top'>"
If varRowCount = Int(CME) Then response.write "</td><td width='210'
valign='top'>"
Country.MoveNext
varRowCount = varRowCount + 1
Loop
%>

Crude but works and guaranteed to offend the CSS purists!

--
Buzby
There's nothing more dangerous than a resourceful idiot
Participating Frequently
April 20, 2007
thanks a lot for your response, i will have a go at this today and post back to say how it went...