Download
Academy
Current location: Downcodes.com -> Academy -> Programming -> ASP tutorial -> Page navigation control
Recommend
HOT TOP10
Page navigation control
Date: 2008-1-4 Author: Hit: View:[Large font Middle font Small font]
If you have multiple records output to a page format, here is a page control you can provide to your users to navigate the output.


<%@ LANGUAGE="VBSCRIPT" %>

<%
    Response.Buffer=true
    Response.AddHeader "cache-control", "private"
    Response.AddHeader "pragma", "no-cache"
    Response.ExpiresAbsolute = #January 1, 1990 00:00:01#
    Response.Expires=Now()-1
    Response.AddHeader "Cache-Control", "must-revalidate"
    Response.AddHeader "Cache-Control", "no-cache"

'------------------------------------
'This page calls itself so get name
'------------------------------------

strScriptName = Request.ServerVariables("SCRIPT_NAME")

'------------------------------------
'Establish number of pages available
'------------------------------------

numpages = 5

'------------------------------------
'find current and adjacent pages
'check for boundary conditions
'------------------------------------

If Cint(request("page")) = 0 then
    page = 1
else
    page = Cint(request("page"))
end if

If Cint(request("page")) <= 1 then
prevpage=1
nextpage=2
elseif Cint(request("page")) >= numpages then
prevpage = numpages-1
nextpage = numpages
else
prevpage = request("page")-1
nextpage = request("page")+1
end if

'------------------------------------
'display user page control
'------------------------------------

%>
<HTML>
<HEAD>
<TITLE>Page Control</TITLE>
<META name="description" content="">
<META name="keywords" content="">
<META name="generator" content="VisualN++">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">

<HR Color="#cccccc">
<H1><FONT color="red" >Your page <%=page%> here</FONT></H1>
<HR Color="#cccccc">

<A HREF="<%=strScriptName%>?page=<%=prevpage%>"><FONT COLOR="#000000"><< Previous</FONT></A>


<SELECT NAME="PageJump" onChange="top.location.href='page selector.asp?Page='+ this.options[selectedIndex].value;">
<%
For i = 1 to numpages
    If i = Cint(request("page")) then
        Response.write("<OPTION SELECTED VALUE=" & i &" >" & I & "</OPTION>")
    Else
        Response.write("<OPTION VALUE=" & i &" >" & I & "</OPTION>")
    End if
Next
%>
</SELECT>
<A HREF="<%=strScriptName%>?page=<%=nextpage%>"><FONT COLOR="#000000">Next >></FONT></A>

</BODY>
</HTML>

(From: aspkey)

Relative article:
Relative software:
Chongqing site navigation generate html v8.520
A very cool flash navigation
198 Web site navigation 2005
88852 Web site navigation No Advertisements
Web site navigation