Classic Crystal Report Design - Click on the Headwork Sort Form

zhaozj2021-02-16  54

1. Newly burse a parameter field of a string type, named URL, used to pass the website of the ASP.NET program and some parameters of the URL. For example: "http://www.nt.cn/cr.aspx?sort_field=".

2. Right click on the text field as a header, select Set Text Format, and go to the Format Editor dialog.

3. Select the "Hyper Link" tab and set the hyperlink type to "URL on the Internet".

4. Click the button of the formula after the website address of the hyperlink information, enter the formula {? URL} "Name".

5. Such a header becomes a hyperlink, and points to http://www.nt.cn/cr.aspx?sort_field=name.

6. ASP.NET program reads the field Sort_Field to be sorted in the Page_Load event, and then sort the crystal report.

7. Crystal Report Sort Programming Example

DIM crreportDocument as reportDocument

Public Sub Changesortfield (MySortfld As String, MySortdir As String)

Dim Crsortfield As Sortfield Dim CrsortDirection As SortDirection Dim CRDATABASEFIELDDEFINITION As DatabaseFieldDefinition

For Each crSortField In crReportDocument.DataDefinition.SortFields If crSortField.Field.Name.ToString = mySortFld Then crDatabaseFieldDefinition = crReportDocument.Database.Tables (0) .Fields (mySortFld.ToString) crSortField = crReportDocument.DataDefinition.SortFields (0) crSortField.Field = CRDATABASEFIELDDEFINITION

If mysortdir = "ascending" TEN CRSORTFIELD.SortDirection = sortdirection.ascendingorder else Crsortfield.SortDirection = SortDirection.DescendingOrder End IF EndixEn

CrystalReportViewer1.reportsource = crreportDocument end sub

转载请注明原文地址:https://www.9cbs.com/read-22455.html

New Post(0)