I'm trying to setup paging with numbers in the middle of Previous and Next buttons. I found a script I like but i have one issue with it. Please help many thanks in advance.
Here the script I found. It uses iNumPerPage for how many records your showing on each page. So if I put 10 per page then it shows ten numbers which is what I want. But I want to show 25 per page it show 25 numbers I only want to show ten numbers at a time. Can you please help me to get this scripted working or if you have an already working script can you please send it to me. Many Thanks!!!!!!
Code:Sub PrintRecordsetNav( iNumPerPage, adodbConnection, adodbCommand, sTable, sURL, sQuerystring ) Dim iTtlNumItems, iDBLoc, sSqlTemp, iTtlTemp Dim iDBLocTemp, sURLBeg, iA, iB, x, iTemp, rsObj iNumPerPage = 25 'row count iNumCount = 10 'how many numbers to display 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



Reply With Quote
Bookmarks