最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
经典水晶报表设计―单击表头排序表格
时间:2022-07-02 11:31:48 编辑:袖梨 来源:一聚教程网
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
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
相关文章
- 原神伊涅芙用什么武器 伊涅芙武器适配推荐 07-12
- Polymarket预测7月比特币达12万美元概率为80% 07-12
- 无畏契约源能行动捷风实战 玩法技巧分享 07-12
- 原神伊涅芙材料是什么 伊涅芙突破材料一览 07-12
- 剑星圣诞服装位置在哪里 圣诞服装获取攻略一览 07-12
- 无畏契约源能行动铁臂实战 实战技巧分享 07-12