Classic Crystal Report Design-click Table Header Sort table

Source: Internet
Author: User
Sort | design | Crystal Report 1. Creates a new string-type parameter field, named URL, that is used to pass the URL of the ASP.net program and some of the parameters of the URL. For example: "http://www.nt.cn/cr.aspx?sort_field=".

2. Right-click the Text field as the header, select Format text, and go to the Format Editor dialog box.

3. Select the Hyperlinks tab and set the hyperlink type to "URLs on the Internet."

4. Click the button of the formula behind the website address of the hyperlink information, and enter the formula {? URL} + ' name '.

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

6. The ASP.net program reads the fields to be sorted in the Page_Load event Sort_field, and then sorts the Crystal Reports.

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" Then
Crsortfield.sortdirection = Sortdirection.ascendingorder
Else
Crsortfield.sortdirection = Sortdirection.descendingorder
End If
End If
Next

Crystalreportviewer1.reportsource = Crreportdocument
End Sub


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.