asp paging problem

W

wk6pack

Hi,

I have an asp page that I would like to do paging. The problem I'm running
into is that the same page that prints to the output is also recieving data
from the previous page for query parameters for the sql string.

When I click on the next page, it queries itself and loses all the query
parameter information from the parameter page and brings back all the
records.

How can I keep the parameter values from the query form and still advance to
the next page?

thanks,
Will
 
S

Simon Wigzell

wk6pack said:
Hi,

I have an asp page that I would like to do paging. The problem I'm running
into is that the same page that prints to the output is also recieving data
from the previous page for query parameters for the sql string.

When I click on the next page, it queries itself and loses all the query
parameter information from the parameter page and brings back all the
records.

How can I keep the parameter values from the query form and still advance to
the next page?

thanks,
Will
In the "next" page, include all the form fields sent to it in the new form
using "hidden" as the field type. They won't show up on the "next" page but
will be added to it's form values. e.g.

Page 1 :

<form....>
<input type="text" name="Page1Field1">
</form>

Page 1 on submit sends it's info to Page 2

Page 2 :

<form....>
<input type="hidden" name="Page1Field1">
<input type="text" name="Page2Field1">
</form>

Page 2 calls page 3

Page 3 :

response.write(request.form(Page1Field1))
response.write(request.form(Page2Field1))

Got it?

Good luck. I spent ages and ages getting all this stuff down pat about
passing form information around.
 
W

wk6pack

Hi Simon,

It doesnt seem to be recognizing the hidden variables? When the form
resubmits itself, the hidden variables are blank.

Here's the code:

<form name="queryform" method='post'>
<%
' ADO constants used in this page
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adCmdTableDirect = &H0200
Const adUseClient = 3

If Len(Request("pagenum")) = 0 Then
lqrystatus = request.form("DropDownStatus") 'incomplete
lqrygrp = request.form("DropDownSort")
lstartdate = request.form("startdate")
lenddate = request.form("enddate")
lplocation = request.form("DropDownLocation")
lqryemp = request.form("DropDownGroup")
'response.write(startdate & ", " & enddate & "," & qrygrp)
Else
lqrystatus = request.form("qrystatus") 'incomplete
lqrygrp = request.form("qrygrp")
lstartdate = request.form("startdate")
lenddate = request.form("enddate")
lplocation = request.form("plocation")
lqryemp = request.form("qryemp")
'response.write(startdate & ", " & enddate & "," & qrygrp)
end if

response.write ("<input type='hidden' name='qrystatus' value='" & lqrystatus
& "'>")
response.write ("<input type='hidden' name='qrygrp' value='" & lqrygrp &
"'>")
response.write ("<input type='hidden' name='startdate' value='" & lstartdate
& "'>")
response.write ("<input type='hidden' name='enddate' value='" & lenddate &
"'>")
response.write ("<input type='hidden' name='plocation' value='" & lplocation
& "'>")
response.write ("<input type='hidden' name='qryemp' value='" & lqryemp &
"'>")

response.write Len(Request("pagenum") & chr(13))
response.write ("hello " & lqryemp & chr(13))



sql and query building in here.....



Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") &
"?pagenum=1"">First Page</a>"

Response.Write "&nbsp;|&nbsp;"

If abspage = 1 Then
Response.Write "<span style=""color:silver;"">Previous Page</span>"
Else
Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") &
"?pagenum=" & abspage - 1 & """>Previous Page</a>"
End If

Response.Write "&nbsp;|&nbsp;"

If abspage < pagecnt Then
Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") &
"?pagenum=" & abspage + 1 & """>Next Page</a>"
Else
Response.Write "<span style=""color:silver;"">Next Page</span>"
End If
Response.Write "&nbsp;|&nbsp;"

if abspage = pagecnt then
Response.Write "<span style=""color:silver;"">Next Page</span>"
Else
Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") &
"?pagenum=" & pagecnt & """>Last Page</a>"
end if
Response.Write "</div>" & vbcrlf


thanks,
Will
 

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,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top