經典水晶報表設計—單擊表頭排序表格

來源:互聯網
上載者:User
排序|設計|水晶報表 1. 建立一個字串類型的參數欄位,名稱為 URL,用於傳遞 ASP.NET 程式的網址和網址的部分參數。比如:"http://www.nt.cn/cr.aspx?sort_field="。

2. 右擊作為表頭的文字欄位,選擇"設定文字格式設定",進入"格式化編輯器"對話方塊。

3. 選擇"超級連結"選項卡,並設定超級連結類型為"Internet 上的網址"。

4. 單擊超級連結資訊的網站地址後面的公式的鈕,輸入公式 {?URL} + "name"。

5. 這樣表頭就變成了超級連結,而且指向 http://www.nt.cn/cr.aspx?sort_field=name。

6. ASP.NET 程式在 Page_Load 事件裡讀取要排序的欄位 sort_field,然後對水晶報表進行排序。

7. 水晶報表排序編程執行個體

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


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.