Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange issue with Paging navigation

Status
Not open for further replies.

PushCode

Programmer
Dec 17, 2003
573
US
I'm doing recordset paging, and I'm having a problem with the navigation.

Let's say that originally, the page url is test.asp. When the page loads for the first time that is the url. However once you begin navigating from one page to the next via the recordset navigation, the url becomes test.asp?Page=1, or test.asp?Page=3, etc...

Everything is working properly except for the "Next Page" navigation. It only works when the url is in its original state of test.asp. Once you begin navigating, the "Next Page" link stays silver and unlinked, which it should actually only do when it's on the very last page of course.

The code follows, I'd appreciate any assistance:
Code:
Response.Write "<div align=""center"">" & vbcrlf
	Response.Write "<a href="""
	Response.Write Request.ServerVariables("SCRIPT_NAME")
	Response.Write "?Page=1""><b>First Page</b></a>"
	Response.Write " | "
	
	If Page = 1 Then
		Response.Write "<span style=""color:silver;"">Previous Page</span>"
	Else
		Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME")
		Response.Write "?Page=" & Page - 1 & """><b>Previous Page</b></a>"
	End If
	Response.Write " | "
	
	For PageCounter = 1 to qProd.PageCount
        Response.Write "<a href='test.asp?Page=" & PageCounter & "'>" & PageCounter & "</a> "
    Next
	
	Response.Write " | "
	If Page >= pagecnt Then
		Response.Write "<span style=""color:silver;"">Next Page</span>"
	Else
		Response.Write "<a href=""" & _
		Request.ServerVariables("SCRIPT_NAME")
		Response.Write "?Page=" & Page + 1 & """>Next Page</a>"
	End If
	
	Response.Write " | "
	Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME")
	Response.Write "?Page=" & pagecnt & """><b>Last Page</b></a>"
	Response.Write "</div>" & vbcrlf
 
pagecnt is declared up near the qProd query.

pagecnt = qProd.PageCount
 
Above your navigation section add a Response.Write for both Page and pagecnt so you can see what there values are on pages other than the first. That ought to give some additional clue as to what is happening.

-T

 
Actually, I tried that. They are correct and as expected, I think that's what I'm most suprised by.
 
Ah, here is something to try. Since the values coming out of the querystring are considered to be strings, occasionally you can get odd results. Try doing a cInt() or cLng() on the Page value you get from the querystring and see if that causes any differences.

-T

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top