本文主要为广大网友提供“分页类,异常类”,希望对需要分页类,异常类网友有所帮助,学习一下!
其它的一些,比如分页类,异常类(用于信息提示),文件操作类(未完成),经常用到的工具类及验证输入的表单验证类(
asp版,配合前台JS版使用更佳):
分页类Pager
<%
Class Pager Private IUrl
Private IPage
Private IParam
Private IPageSize
Private IPageCount
Private IRecordCount
Private ICurrentPageIndex Public Property Let Url(ByVal PUrl)
IUrl = PUrl
End Property Public Property Get Url()
If IUrl = "" Then
If Request.QueryString <> "" Then
Dim query
For Each key In Request.QueryString
If key <> Param Then
query = query & key & "=" & Server.UrlEnCode(Request.QueryString(key)) & "&"
End If
Next
IUrl = Page & "?" & query & Param & "="
Else
IUrl = Page & "?" & Param & "="
End If
End If
Url =IUrl
End Property Public Property Let Page(ByVal PPage)
IPage = PPage
End Property Public Property Get Page()
Page = IPage
End Property Public Property Let Param(ByVal PParam)
IParam = PParam
End Property Public Property Get Param()
Param = IParam
End Property Public Property Let PageSize(ByVal PPageSize)
IPageSize = PPageSize
End Property Public Property Get PageSize()
PageSize = IPageSize
End Property Public Property Get PageCount()
If (Not IPageCount > 0) Then
IPageCount = IRecordCount \ IPageSize
If (IRecordCount MOD IPageSize) > 0 Or IRecordCount = 0 Then
IPageCount = IPageCount + 1
End If
End If
PageCount = IPageCount
End Property Public Property Let RecordCount(ByVal PRecordCount)
IRecordCount = PRecordCount
End Property Public Property Get RecordCount()
RecordCount = IRecordCount
End Property Public Property Let CurrentPageIndex(ByVal PCurrentPageIndex)
ICurrentPageIndex = PCurrentPageIndex
End Property Public Property Get CurrentPageIndex()
If ICurrentPageIndex = "" Then
If Request.QueryString(Param) = "" Then
ICurrentPageIndex = 1
Else
If IsNumeric(Request.QueryString(Param)) Then
ICurrentPageIndex = CInt(Request.QueryString(Param))
If ICurrentPageIndex < 1 Then ICurrentPageIndex = 1
If ICurrentPageIndex > PageCount Then ICurrentPageIndex = PageCount
Else ICurrentPageIndex = 1
End If
End If
End If
CurrentPageIndex = ICurrentPageIndex
End Property Private Sub Class_Initialize()
With Me
.Param = "page"
.PageSize = 10
End With
End Sub Private Sub Class_Terminate()
End Sub Private Function Navigation()
Dim Nav
If CurrentPageIndex = 1 Then
Nav = Nav & " 首页 上页 "
Else
Nav = Nav & " <a href=""" & Url & "1"">首页</a> <a href=""" & Url & (CurrentPageIndex - 1) & """>上页</a> "
End If If CurrentPageIndex = PageCount Or PageCount = 0 Then
Nav = Nav & " 下页 尾页 "
Else
Nav = Nav & " <a href=""" & Url & (CurrentPageIndex + 1) & """>下页</a> <a href=""" & Url & PageCount & """>尾页</a> "
End If Navigation = Nav
End Function Private Function SelectMenu()
Dim Selector
Dim i : i = 1
While i <= PageCount
If i = ICurrentPageIndex Then
Selector = Selector & "<option value=""" & i & """ selected=""true"">" & i &"</option>" &
vbCrLf
Else
Selector = Selector & "<option value=""" & i & """