Pagination | client | data | database | show | Execute Create a paging class
Keep in mind that the entire application here includes only one ASP page. When this ASP page is accessed, it creates all the client JavaScript code that is required to perform the paging of records. To simplify the process, I created a VBScript class to handle this feature. When using this class, the developer simply passes in the recordset that he wants to page through the visitor's Web browser. For the use of classes, read about using classes in VBScript.
I named this class Dhtmlgetrows, which contains two properties and one method. Two properties are:
1, Recsperpage: Determine how many records each page display.
2, Thstring: Through an HTML table to show this is the result of pagination; This property allows you to specify a string for the title of the table.
A single approach is generatehtml (recordsetobject), which returns complete HTML for the paging application: Client JavaScript code and the required div tag. This method requires only one parameter recordsetobject, which should be a Recordset object that populates the database data that you want to display in a paging format.
The code for this class is quite long, and most of the code simply returns the JavaScript code for the client. The following is the code for the class:
' ************ Initialize Event *************
Private Sub Class_Initialize ()
Irecsperpage = Ten ' Assign a default value
End Sub
'*******************************************
' ************ Property Let/get *************
Public Property Let Thstring (strvalue)
' Replace all apostrophes with \ '
strthstring = Replace (strvalue, "'", "\")
End Property
Public Property Get Thstring ()
thstring = strthstring
End Property
Public Property Let Recsperpage (Ivalue)
If ivalue > 0 and IsNumeric (ivalue) Then
Irecsperpage = CInt (ivalue)
End If
End Property
Public Property Get Recsperpage ()
Recsperpage = Irecsperpage
End Property
'*******************************************
' **************** METHODS ******************
Public Function generatehtml (OBJRS)
' Begin by getting an array of the ' data
Dim avalues
Avalues = Objrs.getrows ()
' Find the value of rows and columns
Dim Icols, Irows
Icols = UBound (avalues, 1)
irows = UBound (avalues, 2)
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.