经典水晶报表设计——单击表头排序表格

王朝other·作者佚名  2006-01-08
宽屏版  字体: |||超大  

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有