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