View Full Version : how to get page listing like this in ASP???
NinjaTurtle
11-22-2002, 04:11 AM
dear,
how to get page listing like this in ASP???
|< << < 3 4 5 > >> >|
glenngv
11-22-2002, 05:37 AM
do you mean database paging?
here are some of them:
http://www.cfdev.com/code_samples/code.cfm/CodeID/57/ASP/Paging_code
http://www.codeproject.com/asp/rspaging.asp
allida77
11-22-2002, 01:47 PM
The previous links will show all pages and not break them up. I have this code:
<%
Dim i
If iPageCurrent > 1 Then
%>
<a href="policylistings.asp?<%=strQueryString%>&page=1" class="dbPage" alt="First Page">< </a>
<a href="policylistings.asp?<%=strQueryString%>&page=<%= iPageCurrent - 14 %>" class="dbPage" alt="Previous 10"><<</a>
<%
End If
For i = Request.QueryString("page") To iPageCount - (iPageCount - (14 + Request.QueryString("page")))
If i = iPageCurrent Then
Response.Write(i)
Elseif i < iPageCount + 1 And i > 0 Then
%>
<a href="policylistings.asp?<%=strQueryString%>&page=<%= i %>"><%= i %></a>
<%
End If
Next
If iPageCurrent + 14 < iPageCount Then
%>
<a href="policylistings.asp?<%=strQueryString%>&page=<%= iPageCurrent + 14 %>" class="dbPage" alt="Next 10">>> </a>
<a href="policylistings.asp?<%=strQueryString%>&page=<%= iPageCount%>" class="dbPage" alt="Last Page">> </a>
<%
End If
%>
This will spit out 15 records at a time and you can move to the next or prev 15 records or last page - first page. The original code I got was from asp101 (http://www.asp101.com/samples/viewasp.asp?file=db%5Fpaging%2Easp). You will probaly want to just set a variable for how many pages you want to show instead of just hard coding them( the 14).
whammy
11-23-2002, 12:11 AM
I also just 5 minutes ago posted a reply to the same exact question (christrinder's post) with a link to a db paging example on ASP101.com.
NinjaTurtle
11-23-2002, 02:33 AM
actually the samples that's u all provided is not what i want, bcos without my explanation... sorry.
actually what i want is:
when 2 pages, and i was in page no.2 : |< << 1 2 >> >|
when 4 pages, and i was in page no.2 : |< << 1 2 3 >> >|
when 4 pages, and i was in page no.4 : |< << 2 3 4 >> >|
when 5 pages, and i was in page no.4 : |< << 3 4 5 >> >|
So, u will see the page that i was there will point in the middle, and page number 1 & 2 will disapper.
whammy
11-23-2002, 04:21 AM
Actually, the link I posted in the other thread gives an example of exactly that...
whammy
11-23-2002, 07:14 PM
Oops, referred to the wrong thread:
http://www.codingforums.com/showthread.php?s=&threadid=10289
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.