Re: Recordset Paging - Not Showing records on next page

Tech-Archive recommends: Fix windows errors by optimizing your registry



AnxietyAnswers wrote on Tue, 26 Jun 2007 01:39:18 -0700:

When I use the next button no records show up on the next page...
I've been going over this for half a day and can't figure it out. Any
help would be greatly appreciated!

<form action="<%= Request.ServerVariables("SCRIPT_NAME") %>"
method="POST">
Script Name:
<% Response.Write(Request.ServerVariables("SCRIPT_NAME")) %>
<input type="hidden" name="CurrentPage" value="<%= intCurrentPage%>">
<%
If intCurrentPage > 1 Then %>
<input type="submit" value="Previous">
<% End If
If intCurrentPage <> intTotalPages Then %>
<input type="submit" name=submit value="Next">
<% End if %><% End IF%>
</form>

</body>
</html>

In the above form you don't have any of the fields required to fill the
query with values for the ZIP being looked for, so your query is running
with different data than the initial request, and likely bringing back an
empty recordset which is why you get no results. You'll need to add the ZIP
code as a hidden field in the form so it gets resubmitted with the
Previous/Next button.

Also I can't see anywhere in the code I trimmed out that sets the page to
view - you're reading the AbsolutePage value into the intCurrentPage
variable, rather than setting AbsolutePage to the page you want to view, so
even if you'd been passing the ZIP in the second form you'll just be showing
page 1 of the results again no matter which button is pressed.

Dan


.


Quantcast