Click to See Complete Forum and Search --> : columns
jrthor2
04-17-2003, 05:29 AM
I have a page that shows the members in our church, 10 per page with their picture in 1 column and their address in another column. Is there a way to show maybe 20 per page, having 4 columns, 10 in the first 2 columns, and 10 in the last 2 columns, so it would look like this:
Picture Address Picture Address
Picture Address Picture Address
Picture Address Picture Address
Picture Address Picture Address
Picture Address Picture Address
Picture Address Picture Address
Picture Address Picture Address
Picture Address Picture Address
Picture Address Picture Address
Picture Address Picture Address
jrthor2
04-17-2003, 07:49 AM
I increased my columns to 4, but how do I get the second 2 columns to have the next person in my database? For example, right now it has:
Picture1 Address1 Picture1 Address1
Picture2 Address2 Picture2 Address2
Picture3 Address3 Picture3 Address3
So it is just duplicating the person across the row.
Thanks!!
jrthor2
04-17-2003, 09:09 AM
Here is my index page as an attachment for you to look at my code and maybe show me how to get my columns to look like this:
Picture1 Address1 Picture2 Address2
Picture 3 Address3 Picture4 Address4
etc.
Thanks!!!
jrthor2
04-18-2003, 08:48 AM
I'm not sure I have the Else/End if correct, because now this is what I get:
Picture1 Address1 Picture3 Address3
Picture5 Address5 Picture7 Address7
Picture9 Address9 Picture11 Address11
etc. It is only giving me the odd numbers.
I have attached my code.
Thanks for all your help.
khaki
04-18-2003, 04:28 PM
Hi jrthor2...
I didn't view your attached code (sorry :rolleyes: ... but it was too long for a Friday :) ), but here is how I have placed odd/even-row data side-by-side in a table
(note: If it's a hack... it's a hack. If anyone wants to fix it up... please feel free to do so.
It works though... :rolleyes: )
Is this what you are looking for... or have I over-simplified your question? :rolleyes:
;) k
<table border="1">
<tr>
<td><b>Picture</b></td>
<td><b>Address</b></td>
<td><b>Picture</b></td>
<td><b>Address</b></td>
</tr>
<%
Do While Not rs.EOF
%>
<tr>
<td><%= rs.Fields("picture").Value %></td>
<td><%= rs.Fields("address").Value %></td>
<%
rs.MoveNext
%>
<%
if rs.EOF then
%>
<td><b>end</b></td>
<td><b>end</b></td></tr></table>
<%
else
%>
<td><%= rs.Fields("picture").Value %></td>
<td><%= rs.Fields("address").Value %></td>
<%
end if
on error resume next
rs.MoveNext
Loop
%>
</tr>
</table>
<%
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
%>
jrthor2
04-19-2003, 03:38 AM
I tried your page and this is the result I got:
Picture1 Address1 Picture1 Address1
Picture2 Address2 Picture2 Address2
Picture3 Address3 Picture3 Address3
Picture4 Address4 Picture4 Address4
Picture5 Address5 Picture5 Address5
Picture6 Address6 Picture6 Address6
Picture7 Address7 Picture7 Address7
Picture8 Address8 Picture8 Address8
Picture9 Address9 Picture9 Address9
Picture10 Address10
Still not right, it duplicates the same recod in the row.
jrthor2
04-19-2003, 10:34 AM
Well, I also noticed with your code that when I get to the last page of my results, I get this at the top,
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/Members/index.asp, line 415
Line 415 is this
iRecordCount = iRecordCount + 1
objPagingRS.MoveNext
in your else clause, right before the loop command
khaki
04-19-2003, 10:39 AM
hi jrthor2...
that's why i stuck on error resume next in mine (above the offending line) to prevent that.
i don't know if that's a hack (since i don't provide a true error handler)... but it works (or.. it should) and an error handler shouldn't be needed.... just stop the flow!
;) k
jrthor2
04-21-2003, 05:31 AM
I still get:
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/Members/index.asp, line 416
Line 416 is:
objPagingRS.MoveNext
right before the Loop.
Also, the results are coming out like this still:
Picture1 Address1 Picture1 Address1
Picture2 Address2 Picture2 Address2
Picture3 Address3 Picture3 Address3
Picture4 Address4 Picture4 Address4
Picture5 Address5 Picture5 Address5
Picture6 Address6 Picture6 Address6
Picture7 Address7 Picture7 Address7
Picture8 Address8 Picture8 Address8
Picture9 Address9 Picture9 Address9
Picture10 Address10
Attached is my code.
jrthor2
04-21-2003, 08:27 AM
Well, that got rid of the asp error, but now my results are back to this:
Picture1 Address1 Picture1 Address1
Picture3 Address3 Picture3 Address3
Picture5 Address5 Picture5 Address5
Picture7 Address7 Picture7 Address7
Picture9 Address9 Picture9 Address9
Ribeyed
04-21-2003, 10:57 AM
hi,
sorry didn't have much time to go through your code but here is a solution to your problem. Maybe you can modify it to suit what you need.
<%
set DBConn = server.CreateObject("ADODB.Connection")
DBConn.Open "pic"
sql = "SELECT * FROM tblPicture"
set RS = DBConn.execute(sql)
varanything = "blue"
%>
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<%while not RS.EOF
if varanything = "blue" then
%>
<tr>
<%
end if
%>
<td><%=RS(1)%></td>
<td><%=RS(2)%></td>
<%
if varanything = "blue" then
varanything = "red"
else
%>
</tr>
<%
varanything = "blue"
end if
%>
<%
RS.Movenext
wend
%>
</table>
<%
RS.Close
set RS = nothing
DBConn.Close
set DBConn = nothing
%>
jrthor2
04-21-2003, 12:58 PM
I'm not followig your logic and how to update my code. I attached my code in my last post for anyone who can help. I'm not real ASP experienced.
Ribeyed
04-21-2003, 01:28 PM
which page are you working with?
jrthor2
04-21-2003, 02:24 PM
here it is, atached
Ribeyed
04-21-2003, 03:57 PM
hi,
did you code that page or someone else?
surely you can understand the code i gave you, if you can understand the page you posted for me.
jrthor2
04-21-2003, 04:52 PM
Most of the code was downloaded from various sites. I customized most of it though for my site. Can you help me with this or not though. I need this kind of soon.
Thanks for your help
Ribeyed
04-21-2003, 06:33 PM
hi,
hmm....i'm sorry i think i have helped all i can. I have give you working code for your problem maybe if you try inserting it into your code yourself then post your code here again if your getting errors. You have a lot of code in your page which would take me a while to set something up to test it against, you have database connections, recordsets, inc files, which we don't have. This would all need to be set up local for me to test against.
jrthor2
04-22-2003, 07:20 AM
THAT WORKS GREAT, THANKS FOR ALL YOUR HELP!!!!!!!
Jus 1 more minor detail. Before, when I wasn using the columns, I had the row color alternate between light purple and white. Now, all the rows are light purple, and I'm sure it has to do with the code:
If iRecordCount Mod 2 = 0 Then
mycolor = "#d7d7ff"
Else
mycolor = "#ffffff"
End If
Is there a way to make the row color alternate now?
Thanks again for all your help!!!!
jrthor2
04-22-2003, 07:39 AM
Cool, that worked like a charm. Than you VERY much for all of your help. You are great!!!!