Paging with ASP Classic

N

news

Hello all;

I have ran out of resources and thought that I would try my luck here.
Hopefully someone will have some information for me.

I need to do a paging system.
( I know how to do a basic paging system)
What I need is something like this.

1 5 9
2 6 10
3 7 11
4 8 12
exc.....

Where the records will run down 1 row for a set number
Then run down another row, then a 3rd row.
For a set number of records per page. Like maybe 25 - 30+ records per page.

I have a nice paging system in place now, that I can use, if I can get some
code to do this.

Any ideas on doing something like this?
Thanks all
Carrzkiss
 
N

news

Hello Adrienne
Thanks a bunch for the example. Works great as is.
But how would I go about implementing a RecordSet into it?

Lets say that the RecordSet is:

objRs("MyField")

And have it go through and list all the records in the table for this field?

Thanks

----- Original Message -----
From: "Adrienne Boswell"

<html>
<head>
<title>Table</title>
</head>
<body>
<table>
<tr>
<td>
<%
for i = 1 to 100
response.write i & "<br>"
if i mod 20 = 0 then
response.write "</td><td>"
end if
next
%>
</td>
</tr>
</table>
</body>
</html>
 
E

Evertjan.

news wrote on 03 jul 2009 in microsoft.public.inetserver.asp.general:
Thanks a bunch for the example. Works great as is.
But how would I go about implementing a RecordSet into it?

Lets say that the RecordSet is:

objRs("MyField")

And have it go through and list all the records in the table for this
field?

I hate recordset use, why not simple sql?

You did not specfy the type of db engine.

I read somewhere:

"In MySQL, LIMIT x,y means skip the first x records,
and then return the next y records."

This would hice a nice solutiion:

sql= "SELECT .... LIMIT " & session("pointer") & ",10"

.....

session("pointer") = session("pointer") + 10

===============================

If not available you could mimic this LIMIT by a double select

pseudocode:

SELECT FROM
(SELECT FROM db TOP " & session("pointer") + 10 & " desc)
TOP 10 asc

[nothing tested]
 
N

news

Hello "Evertjan."

Sorry for not mentioning.
(Tested on either) Access Database (or) SQL Server, But will be used with
SQL Server.

I am not sure that I follow you on the session("Pointer")
Or how to use it with what I am needing.


The code supplied by: Adrienne Boswell
Seems to be what I need, but am having a hard time implemented it with a
database.

There is nothing available online for it.
Everything that you find online is either:

1 2 3 4 5
6 7 8 9 10
11 12 13 14 15

(or)

1
2
3
4
5

And I am needing

1 5 9
2 6 10
3 7 11
4 8 12

Thanks a lot guys.
 
A

Adrienne Boswell

Hello "Evertjan."

Sorry for not mentioning.
(Tested on either) Access Database (or) SQL Server, But will be used
with SQL Server.

I am not sure that I follow you on the session("Pointer")
Or how to use it with what I am needing.


The code supplied by: Adrienne Boswell
Seems to be what I need, but am having a hard time implemented it with
a database.

Change the i to whatever fields you are getting out of your recordset.

<html>
<head>
<title>Table</title>
</head>
<body>
<table>
<tr>
<td>
<%
'however you are looping through the recordset
for i = 1 to 100
response.write field.value & "<br>"
if i mod 20 = 0 then
response.write "</td><td>"
end if
next
%>
</td>
</tr>
</table>
 
N

news

(((Not sure if the last post went through or not)))

Hello Adrienne
Thanks for your reply.
I had already tried that as well as other things and this is what I get.

<%
While Not objRs.EOF and Count < objRs.PageSize
for i = 1 to 100
st = objRs("MyTitle")
response.write st & "<br>"
if i mod 20 = 0 then
response.write "</td><td>"
end if
objRS.MoveNext
next
wend
%>

I get
5 Columns
100 Rows

So it is doing as the code originally wants, but ignoring the 20-rows
Here is the actual code with over a 1000+ intries in an Access Database to
test for yourself if you do not mind.
http://www.cffcs.com/Projects/ColumnsRows/Columns.zip

Wayne
 
A

Adrienne Boswell

Gazing into my crystal ball I observed "news" <[email protected]> writing in

Please don't top post. Post correct, see bottom:
(((Not sure if the last post went through or not)))

Hello Adrienne
Thanks for your reply.
I had already tried that as well as other things and this is what I
get.

<%
While Not objRs.EOF and Count < objRs.PageSize
for i = 1 to 100
st = objRs("MyTitle")
response.write st & "<br>"
if i mod 20 = 0 then
response.write "</td><td>"
end if
objRS.MoveNext
next
wend
%>

I get
5 Columns
100 Rows

So it is doing as the code originally wants, but ignoring the 20-rows
Here is the actual code with over a 1000+ intries in an Access
Database to test for yourself if you do not mind.
http://www.cffcs.com/Projects/ColumnsRows/Columns.zip

Wayne, I'm sorry, but I will not download a zip file. I'm sure you're a
very trustworthy person, but one can never tell.

How many records in pagesize? What 20 rows are you talking about?
Change the order around:

<%
for i = 1 to 100
While Not objRs.EOF and Count < objRs.PageSize
st = objRs("MyTitle")
response.write st & "<br>"
if i mod 20 = 0 then
response.write "</td><td>"
end if
objRS.MoveNext
wend
next
%>
 
N

news

Hello AdrienneNot a problem.

OK. Lets look at your code for a minute shall we?

<% for i = 1 to 100 ' How many records that we want to call to the page #1
response.write i & "<br>"
if i mod 20 = 0 then ' How many ROWS that we want to display. #2
response.write "</td><td>"
end if
next
%>

#2 is the 20 Rows that I am referring to.

OK.
Now, to your newest code sample, does not work. Shows 1 complete line only.
If I only have 10 records in the PageSize, it will only show 10 in 1 Column.
If I have 100 in the PageSize, then it will show 100 in a complete single
Column.

So, This code here is no good.
<%
for i = 1 to 100
While Not objRs.EOF and Count < objRs.PageSize
st = objRs("MyTitle")
response.write st & "<br>"
if i mod 20 = 0 then
response.write "</td><td>"
end if
objRS.MoveNext
wend
next
%>


Have a good 4th of July.

Wayne
 
A

Adrienne Boswell

Hello Adrienne
Not a problem.


OK. Lets look at your code for a minute shall we?

<% for i = 1 to 100 ' How many records that we want to call to the page
#1
response.write i & "<br>"
if i mod 20 = 0 then ' How many ROWS that we want to display.
#2 response.write "</td><td>"
end if
next
%>

#2 is the 20 Rows that I am referring to.

OK.
Now, to your newest code sample, does not work. Shows 1 complete line
only. If I only have 10 records in the PageSize, it will only show 10
in 1 Column. If I have 100 in the PageSize, then it will show 100 in a
complete single Column.

Wayne, it's untested. You'll have to play around with it until you get
it right. Don't do it today, have some food, fireworks and maybe a
libation or two.
Have a good 4th of July.

Thanks, I'm going to. Hope you have a happy 4th as well. But, don't
over do it on the libations if you want to get started back on your
project tomorrow.
 
N

news

The weekend is over.
And I have almost completed my project, just need a few extra goodies done.
And this is one of them.

Adrienne
Do you think that you could assist me a little more with this issue please
if you have the time?

Hope you had a good 4th of July celebration, mine was spent here on the
system.
trying to get this thing completed.

Wayne
 
N

news

Hello "Adrienne Boswell"

Just wanted to check back with you on this one, And see if you had any
idea's on how to correctly
Implement this code with a database?

Have a good one
 
E

Evertjan.

news wrote on 16 jul 2009 in microsoft.public.inetserver.asp.general:
Just wanted to check back with you on this one, And see if you had any
idea's on how to correctly
Implement this code with a database?

This one?

please always quote on usenet, or use email
 
N

news

This one?
please always quote on usenet, or use email

Sorry.
I use Outlook Express as my News Reader, so everything is right here, did
not think about the outside programs
That do not group messages.

So, will quote from now-on.

Wayne
 
A

Adrienne Boswell

Sorry.
I use Outlook Express as my News Reader, so everything is right here,
did not think about the outside programs
That do not group messages.

So, will quote from now-on.

Actually, it isn't so much about the news client as it is about the news
server. Servers differ in what they retain, some servers retain
messages longer than others, so you might not be able to go back and see
the original message, but I might because my provider has longer
retention.
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top