Filling out the missing squares in my picture grid - HELP

L

Laphan

Hi All

I know the subject sounds strange, but please bear with me.

Using ADO/ASP, I want to retrieve a list of pics from my db (which will be
dynamic number of pics as a user will be uploading anything from 1 to 12
pics) and put them in a grid (table) of say 3 x 4 cells.

I think this is easy to do if the user has uploaded 12 pics, as the
recordset's recursive loop will create the table for me, but my problem is
that what if they only upload 4, 5 or 7. How do I list these pics in my
grid, but get the ASP to neatly finish off the 3 x 4 grid? If I just leave
it to my recordset of say 7 recs then my 3 x 4 table is going to disjointed
and unfinished.

I hope this makes sense and hope you know of a way round it.

Many thanks.

Rgds

Laphan
 
D

dlbjr

If Not rs.EOF Then
intCellMax = 3 ' Set to Column width you prefer
intCellCount = 0
With Response
.Write "<TABLE><TR>"
Do While Not rs.EOF
If intCellCount = intCellMax Then
.Write "</TR><TR>"
intCellCount = 0
End If
intCellCount = intCellCount + 1
.Write "<TD>"
.Write rs("WhatEver")
.Write "</TD>"
rs.MoveNext
Loop
If intCellCount < intCellMax And intCellCount > 0 Then
For i = (intCellCount + 1) To intCellMax
.Write "<TD>&nbsp;</TD>"
Next
End If
.Write "</TR></TABLE>"
End With
End If

'dlbjr
'Pleading sagacious indoctrination!
 
L

Laphan

Many thanks dlbjr

I'll give it a go.

Rgds

Laphan


If Not rs.EOF Then
intCellMax = 3 ' Set to Column width you prefer
intCellCount = 0
With Response
.Write "<TABLE><TR>"
Do While Not rs.EOF
If intCellCount = intCellMax Then
.Write "</TR><TR>"
intCellCount = 0
End If
intCellCount = intCellCount + 1
.Write "<TD>"
.Write rs("WhatEver")
.Write "</TD>"
rs.MoveNext
Loop
If intCellCount < intCellMax And intCellCount > 0 Then
For i = (intCellCount + 1) To intCellMax
.Write "<TD>&nbsp;</TD>"
Next
End If
.Write "</TR></TABLE>"
End With
End If

'dlbjr
'Pleading sagacious indoctrination!
 

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

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top