Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

page count - asp

Status
Not open for further replies.

nomu26

Programmer
Sep 10, 2003
22
ZA
I'm displaying records from a database and need only to display 20 records on a page - if records are more than 20 a link 'next20' and 'pre20' should display but it less the link shouldn't display.
Here's my code tell me what I'm doing wrong:

<%Const iPageSize = 20
dim LogInID, intPageCnt, intTotalPage, intAbsolutePage, intCurrentPage
intCurrentPage = CInt(Request(&quot;CurrentPage&quot;))

Select Case Trim(Request(&quot;pg&quot;))
Case &quot;prev&quot; :
intCurrentPage = intCurrentPage - 1
Case &quot;next&quot; :
intCurrentPage = intCurrentPage + 1
End Select
if intCurrentPage = 0 then intCurrentPage = 1
if Not (rs.EOF) then
rs.AbsolutePage = intCurrentPage
intTotalPage = rs.PageCount
end if
%>
<table width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;1&quot; cellspacing=&quot;1&quot;>
<tr>
<td colspan=&quot;1&quot; align=&quot;center&quot;>
<input type=&quot;hidden&quot; name=&quot;CurrentPage&quot; value=&quot;<%=intCurrentPage%>&quot;>
<%if intCurrentPage > 1 then%>
<a href=&quot;Admin.asp?pg=prev&CurrentPage=<%=intCurrentPage%>&quot;>Previous 20 </a>  
<%end if%>
<%if intCurrentPage <> intTotalPage -1 then %>
<a href=&quot;Admin.asp?pg=next&CurrentPage=<%=intCurrentPage%>&quot;>Next 20 </a>  
<%end if%>
</td>
</tr>
</table>
 
Hi nomu26

this is the asp.net forum and that's a definite asp question. You'll probably get more luck over there. Admittedly this is exactly the sort of problem that switching to asp.net makes a LOT easier. If you do wish to switch to dotnet the Datagrid control can handle most of the hard work for paging recordsets and is a breeze to use. there is a pretty good series of articles on 4guysfromrolla...


Rob
 
thanks for the tip my brother but I'm also using asp.net it's just that this application I need help with was developed in asp and there's no way I'm gonna convert the whole thing now to .NET cause it's just this small problem I have and everything will work fine so if anyone could help me with this problem I have - recordsets navigation I would really appreciate it.

Nomu26
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top