Implementation of ASP Universal paging

Source: Internet
Author: User
Tags prev

The common pagination you write yourself to set the number of paging links that are displayed, with the Drop-down selection:

1<% 2 ' written by Shaoyun 20:17 May 29, 2008 0:38 3 ' Email:shaoyun at yeah.net 4 ' blog:http://shaoyun.cnblogs.com 5 ' paging function: SP Litpage (total number of records, number of records per page, display several paging links) 6Function Splitpage (rscount,pagesize,shownum) 7 8Dim pagenum,curpage,first_page,last _page,up_page,down_page,idx,addr_url,splitpage_html 9 10addr_url=request.servervariables ("url") 11addr_url=Mid ( Addr_url,instrrev (Addr_url, "/") +1 12addr_url=addr_url & "? page=" 14if (rscount mod pagesize) =0 Then Count/pagesize 16else pagenum=rscount/pagesize+1 18end if 19first_page=1 20last_page=pagenum 22curpage=1 23if isnum Eric (Request. QueryString ("page")) then Curpage=trim (request. 
QueryString ("page")) ' if Pagenum-curpage<0 then curpage=pagenum 26else curpage=1 28end if ' 30up_page=curpage-1 31down_page=curpage+1 33splitpage_html= "Total $rscount$ records &nbsp; $pagesize $/page &nbsp; $curpage$/$pagenum $ page
&nbsp; " 34splitpage_html=replace (splitpage_html, "$rscount $", Rscount) 35splitpage_html=replace (splitpaGe_html, "$pagesize $", pagesize) 36splitpage_html=replace (splitpage_html, "$curpage $", curpage) 37splitpage_html= Replace (splitpage_html, "$pagenum $", pagenum) 39splitpage_html=splitpage_html & "<a href= '" & Addr_url
& First_page & "' > Home </a>&nbsp;" 40if curpage>1 then splitpage_html=splitpage_html & "<a href=" "& Addr_url & Up_page &" ' > Prev
</a>&nbsp; "
42else splitpage_html=splitpage_html & "Prev &nbsp;" 44end if 46dim fbegin,fend 47if shownum mod 2 then Show_front_num=int (SHOWNUM/2) show_back_num=int (SHOWNUM/2) 5 
0else Wuyi Show_front_num=int (SHOWNUM/2)-1 show_back_num=int (SHOWNUM/2) 53end if 54if Curpage-1<show_front_num then Fbegin=1 fend=shownum 57elseif Curpage+show_back_num>pagenum then Fend=pagenum 1 60else fbegin=curpage-show_front_num fend=curpage+show_back_num 63end if 64for idx=fbegin to fend-if curpage -idx=0 then Splitpage_hTml=splitpage_html & "<b>" & idx & "</b>&nbsp;" Splitpage_html=splitpage_html & "<a href= '" & Addr_url & idx & "' > ' & idx &"
</a>&nbsp; " End If 70next 72if pagenum-curpage>0 then splitpage_html=splitpage_html & "<a href= '" & Addr_url
& Down_page & "' > Next page </a>&nbsp;"
74else splitpage_html=splitpage_html & "Next page &nbsp;" 76end if 77splitpage_html=splitpage_html & "<a href=" "& Addr_url & Last_page &" ' > Last </a>&amp
; nbsp; "
79splitpage_html=splitpage_html & "Jump to &nbsp;" 80splitpage_html=splitpage_html & "<select Onchange=window.location.href=this.options[this.selectedindex].  Value> "81For idx=1 to Pagenum" If curpage-idx=0 Then-splitpage_html=splitpage_html & "<option value= '" & Addr_url & idx & "' selected>" & idx & "Page </option>"-Else SPLITPAGE_HTML=SPLITPAge_html & "<option value=" "& Addr_url & idx &" ' > First "& idx &" Page </option> " 87Next 88splitpage_html=splitpage_html & "</select>" 90response. Write splitpage_html 92End Function 93%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.