My application, written in VB.NET 2005, uses reports designed in CR XI.
The user should be able to re-sort certain areas of the reports. Thus opens up 2 important questions:
1. How can I add SortFields programatically? The SortFields-Collection doesn't provide any Add-method...
2. Using predefined sortfields (defined in CR XI) in subreports reveals another problem: The subreports are resorted in background but aren't updated in the CRViewer. How do I force the subreports to be updated?
I tied something like this:
Dim rptSubBericht As ReportDocument = rptBericht.OpenSubreport(rptBericht.Subreports(intReport).Name)
If rptSubBericht.Database.Tables(0).Location.Substring(rptSubBericht.Database.Tables(0).Location.LastIndexOf(".") + 1) = View Then
For intFeld As Integer = 0 To 2
Dim sfdFeld As SortField = rptSubBericht.DataDefinition.SortFields(intFeld)
With sfdFeld
If Not SortierFelder(intFeld) Is Nothing Then
.Field = rptSubBericht.Database.Tables(0).Fields(SortierFelder(intFeld))
End If
.SortDirection = SortDirection.AscendingOrder
End With
Next
CrystalReportViewer1.ReportSource = rptBericht
This does not(!) update the subreports within the Viewer.
Thx
Ontario