I’m giving a talk at the MVP Summit in Seattle on Sunday afternoon. The session focuses on the premise that it’s easier to create user interface (UI) that includes formatting, aggregates, graphics and the rest with a report (or several). I’ve provided some of the technical details here.
This example application illustrates a parent/child UI that let’s the user browse through a customer list using a Chart control to help navigate through the sales territories, regions and states. When the user clicks a pie slice the Report Processor routes control back to your application via a DrillThrough event passing as many parameters as needed. In this case we pass through the value from the pie-slice clicked by the user.
Another tip: You must program the Chart control’s Data | Action to link to another report—any report. You also need to add parameters to pass back the needed values. These Parameters must be added to the target report whether they’re used or not. If they aren’t needed by the target report, mark them as hidden so they won’t interfere with the rendering operation.
In the Drillthrough event handler, you extract the parameters from the “e” variable passed to the event.
Private Sub rvTerritoryGraph_Drillthrough(ByVal sender As Object, _
ByVal e As Microsoft.Reporting.WinForms.DrillthroughEventArgs) _
Handles rvTerritoriesChart.Drillthrough
Try
Dim rpiRegionWanted As ReportParameterInfo = e.Report.GetParameters("prmRegionWanted")
strRegionWanted = CStr(rpiRegionWanted.Values(0))
Dim rpiTerritoryWanted As _
ReportParameterInfo = e.Report.GetParameters("prmTerritoryWanted")
strTerritoryWanted = CStr(rpiTerritoryWanted.Values(0))
Me.AdventureWorks2008DataSet.EnforceConstraints = False
Me.CustomerAddressTableAdapter.FillByRegionAndTerritory( _
Me.AdventureWorks2008DataSet.CustomerAddress, strRegionWanted, strTerritoryWanted)
Me.rvCustomer.RefreshReport()
Catch exLp As LocalProcessingException
MsgBox(String.Format("{0} {1} {2}", exLp.Message, vbCrLf, exLp.InnerException))
Catch ex As Exception
MsgBox(ex.ToString)
Finally
e.Cancel = True ' All we want is the Parameter. We will re-render the report
' with new data based on the passed parameter
End Try
End Sub
The final tip: Make sure to set the e.Cancel argument to True to make sure the target report is not rendered. While you might want to launch this report, if you do so via the Drillthrough event, you’re adding another report instance to the stack so you’ll need to setup the Data Source and Parameters and everything. It’s a lot easier to simply re-run the Fill method and execute the Refresh.
hth

thanks a lot,u saved my day