All posts by Moazam

ASP: Digg Style Pagination Script

This is ASP based pagination script, similiar to Digg.com pagination. The credit goes to Jason Coleman who written this script in PHP and I simply converted this into ASP. I have attached screenshot this will help you to see how it looks like.

Demo Digg Style Pagination Script

Download Script

Usage

Many people were asking how to add this code into our own projects. I have included the code, I hope this will help you in integrating this script.

<!–#include file=”pagination.asp” –>
<%
dim objcon, objrs, totalpages, page, numPerPage, countItem
set objcon=Server.CreateObject(“ADODB.Connection”)
set objrs=Server.CreateObject(“ADODB.RecordSet”)
countItem = 0
numPerPage = 5
objrs.cursorlocation = 3
if request(“page”) = “” then
page=1
else
page=cLng(request(“page”))
end if
objcon.open connectionString
objrs.open “SELECT * FROM Customers”, objcon,1,2
if objrs.EOF then
Response.Write(“<h2>Sorry! No Search Result Found</h2>”)
else
objRs.pageSize = numPerPage
totalpages = objRs.PageCount
objRs.absolutePage=page
while not objrs.EOF AND countItem < objRs.pageSize
Response.Write(“YOUR CODE GOES HERE”)
countItem = countItem + 1
objrs.movenext()
wend
ps = getPaginationString(page, objrs.RecordCount, numPerPage, 2, “demo.asp?yourcustomparams=PARAM&name=NAME&Search=Search”)
Response.Write(ps)
end if
‘always cleanup things
objrs.close()
objcon.close()
set objrs=nothing
set objcon=nothing
%>