Classic crystal report design-click the table header to sort the table

Source: Internet
Author: User

1. Create a New String-type parameter field named URL to pass some parameters of the URL and URL of the ASP. NET program. For example: "http://www.nt.cn/cr.aspx? Sort_field = ".
2. Right-click the text field used as the header and select "set text format" to enter the "format Editor" dialog box.
3. Select the "HYPERLINK" tab and set the hyperlink type to "URL on the Internet ".
4. click the button next to the URL of the hyperlink and enter the formula {? URL} + "name ".
5. So the header becomes a hyperlink and points to the http://www.nt.cn/cr.aspx? Sort_field = name.
6. the ASP. NET Program reads the sort_field to be sorted in the Page_Load event and sorts the crystal report.
7. Crystal Report sorting programming example
Dim crReportDocument As ReportDocument
Public Sub changeSortField (mysort‑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 = mysortdomainthen
CrDatabaseFieldDefinition = crReportDocument. Database. Tables (0). Fields (mysortworkflow. 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

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.