Add to Favorites    Make Home Page 14816 Online  
 Language Categories  
 Our Services  

Home » ASP Home » Array Home » Pagination Script in ASP

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title Pagination Script in ASP
Description The purpose of this function is to help create ASP applications with pagination--really easy.

Parameters: --iNumPerPage: the number of items To display on Each page. --sURL:the page To link to. --sQuerystring:any additional querystring information. --adodbConnection, adodbCommand, sTable: are all For getting the initial rowcount (only uses this on the first run).
Category ASP » Array
Hits 365769
Code Select and Copy the Code
'*************************************** ' ' * ' iNumPerPage is the number of items to ' display on each page ' sURL is the page to put with the link ' , sQuerystring is additional qs stuff ' adodbConnection, adodbCommand, sTable ' are all for the table to get row count from. * ' * ' Print out the numbers (if any) betwee ' n the "previous" and "next" buttons ' It'll act like this (current # is in ' bold): ' 1 2 3 4 5 6 7 8 9 <b>10</b> >> next ' previous << <b>11</b> 12 13 14 15 16 17 18 * ' * '' **************************************** Sub PrintRecordsetNav( iNumPerPage, adodbConnection, adodbCommand, sTable, sURL, sQuerystring ) Dim iTtlNumItems, iDBLoc, sSqlTemp, iTtlTemp Dim iDBLocTemp, sURLBeg, iA, iB, x, iTemp, rsObj iDBLoc = CInt(Request("iDBLoc")) iTtlNumItems = CInt(Request("iTtlNumItems")) ' Get ttl num of items from the database if it's Not already In the QueryString If (iTtlNumItems = 0) Then Set rsObj = Server.CreateObject("ADODB.Recordset") sSqlTemp = "SELECT COUNT(*) FROM " & sTable adodbCommand.CommandText = sSqlTemp rsObj.Open adodbCommand If Not(rsObj.EOF) Then iTtlNumItems = rsObj(0) End If rsObj.Close Set rsObj = Nothing End If iTtlTemp = iTtlNumItems iNumPerPage ' this is the number of numbers overall (use the "" To return int) iDBLocTemp = iDBLoc iNumPerPage ' this is which number we are currently On (use the "" To return int) If (sQuerystring <> "") Then sURLBeg = "<A href = """ & sURL & "?" & sQuerystring & "&iTtlNumItems=" & iTtlNumItems & "&iDBLoc=" Else sURLBeg = "<A href = """ & sURL & "?iTtlNumItems=" & iTtlNumItems & "&iDBLoc=" End If '***** BEGIN DISPLAY ***** ' Print the "Previous" If (iDBLoc <> 0) Then Response.Write sURLBeg & (iDBLoc - iNumPerPage) & """>Previous</A> " End If ' Print the << If (iDBLocTemp >= iNumPerPage) Then Response.Write sURLBeg & (( iDBLocTemp iNumPerPage ) * iNumPerPage ^ 2) - (iNumPerPage * 9) & """><<</A> " End If ' Print the numbers in between. Print them out in sets of 10. iA = ( iDBLocTemp iNumPerPage ) * iNumPerPage iB = ( iDBLocTemp iNumPerPage ) * iNumPerPage + iNumPerPage For x = iA To iB iTemp = (x * iNumPerPage) If (iTemp < iTtlNumItems) Then ' takes care of extra numbers after the overall final number If (iDBLoc = iTemp) Then Response.Write " <B>[" & x+1 & "]</B>" Else Response.Write " " & sURLBeg & (x * iNumPerPage) & """>" & x+1 & "</A>" End If Else Exit For End If Next ' Print the >> If (iTtlTemp > iDBLocTemp) Then If ((iDBLocTemp + iNumPerPage) <= iTtlTemp) Then Response.Write " " & sURLBeg & (( iDBLocTemp iNumPerPage ) * iNumPerPage + iNumPerPage ) * iNumPerPage & """>>></A> " End If End If ' Print the "Next" If ((iDBLoc + iNumPerPage) < iTtlNumItems) Then Response.Write " " & sURLBeg & (iDBLoc + iNumPerPage) & """>Next</A>" End If '***** End DISPLAY ***** End Sub

Related Source Codes

Script Name Author
ııııııııııııııııııııı VyomWorld
Resistor color code reader A.Chermarajan.
Telephone Directory dhivya
card swapping game (Mini Project) nityanand
simple hangman-pascalsource Seabert
college dirtectory (Mini Project) msridhar
Poll Application John van Meter
ASP Daily Hit Counter. Tejaskumar Gandhi
To avoid null in asp environment using sql Sami
Maklumbalas webmaster
poll John van Meter
EasyASP Template Engine. TjoekBezoer
Basic Calculator using HTML & Javascript. Patrick M. D Souza
What servers support ASP ? VyomWorld
What is ASP? VyomWorld

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=22


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review