Search results
Suggest a FeaturePDF

Report interaction events

You can handle the report processing actions and interact with reports using the following events.

  • ReportLoaded
  • ReportError
  • Drill through
  • Hyperlink

Report loaded

The ReportLoaded event fires once the report loading is completed and ready to start the processing. You can handle the event and specify data source, parameters at client-side. The following sample code loads a report by assigning report data source input in the ReportLoaded event.

In this tutorial, product-list.rdlc report is used, you can add the report from Bold Reports® installation location. For more information, see Samples and demos.

this.reportViewer.ReportLoaded += (sen, arg) =>
{
    this.reportViewer.DataSources.Clear();
    this.reportViewer.DataSources.Add(new BoldReports.Windows.ReportDataSource { Name = "list", Value = ProductList.GetData() });
};
this.reportViewer.ProcessingMode = BoldReports.UI.Xaml.ProcessingMode.Local;
this.reportViewer.ReportPath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\product-list.rdlc");
this.reportViewer.RefreshReport();

Report error

When an error occurs in the report processing, it raises the ReportError event. You can handle the event and show the details in your custom dialog instead of component default error detail interface.

this.reportViewer.ReportError += (sen, arg) =>
{
    MessageBox.Show(arg.Message, "ReportError", MessageBoxButton.OK);
};
this.reportViewer.ProcessingMode = BoldReports.UI.Xaml.ProcessingMode.Local;
//this.reportViewer.ReportPath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\product-list.rdlc");
this.reportViewer.RefreshReport();

Drill through

When a drill through item is selected in a report, it invokes the DrillThroughReport event. You can change the drill through arguments such as report parameter and data sources. The following sample code can be used to change the drill through report name and set the parameter value before the drill through report is rendered.

this.reportViewer.DrillThroughReport += (sen, arg) =>
{
    List<BoldReports.Windows.ReportParameter> parameters = new List<BoldReports.Windows.ReportParameter>();
    BoldReports.Windows.ReportParameter parameter = new BoldReports.Windows.ReportParameter();
    parameter.Name = "EmployeeID";
    parameter.Values = new List<string>() { "4" };
    parameters.Add(parameter);

    //Assign the drill through report path and parameters
    arg.ReportPath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\personal-details.rdl");
    arg.Parameters = parameters;
};
this.reportViewer.ReportPath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\sales-person-details.rdl");
this.reportViewer.RefreshReport();

The Hyperlink event occurs when the user clicks a hyperlink in a report, before the hyperlink is followed. The following sample code redirects to a new custom URL and cancels the component default action.

this.reportViewer.Hyperlink += (sen, arg) =>
{
    arg.Cancel = true;
    System.Diagnostics.Process.Start(arg.Hyperlink);
};
this.reportViewer.ReportPath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\customer-support-analysis.rdl");
this.reportViewer.RefreshReport();