ASP looping

D

Deepiceman

Hi guys,

I have a database with many fields. One of this field is of type memo
which contains some bullet points seperated by # sign (something along
those lines). What I have is this code which gives me a table with one
row and as many columns in the split array.

************************************************************************

<table width="200" border="0">
<% MyStringTerm = rs.Fields("bullet")
if MyStringTerm <> "" Then
MyStringArray = Split (MyStringTerm, "#")
Response.Write "<tr>"
For Each Term In MyStringArray
Response.Write "<td><img width='13' height='13'
src='images/check.gif'></td><td>"
Response.Write Term
Response.Write "</td>"
Next
Response.Write "</tr>"
Else
Response.Write rs.Fields.Item("Bullet").Value
End if%>
</table>

************************************************************************

What I want is to change the code so that instead of getting
everything in one row the items are split into a table with 6 columns
and as many rows as required by the data being passed. Each row will
look something like this.
Image --- Data --- Image --- Data --- Image --- Data

Is this possible? The images are going to be the same for the most
part. I am not very good with asp but have to get this to work.
Any help would be appreciated
Thanks in advance
Deep
 
L

Lord Unspecified

I would put a counter in and whenever it hits 6, reset it and start over.
for example:
************************************************************************

<table width="200" border="0">
<%
Dim iColCount
iColCount = 1
MyStringTerm = rs.Fields("bullet")
if MyStringTerm <> "" Then
MyStringArray = Split (MyStringTerm, "#")
Response.Write "<tr>"
For Each Term In MyStringArray
Response.Write "<td><img width='13' height='13'
src='images/check.gif'></td><td>"
Response.Write Term
Response.Write "</td>"
if iColCount = 6 then
response.write "</tr><tr>"
iColCount = 1
end if
Next
Response.Write "</tr>"
Else
Response.Write rs.Fields.Item("Bullet").Value
End if%>
</table>

************************************************************************

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top