Skip to main content
All docs
V23.2

IDrillThroughProcessor Interface

Implements drill-through functionality in web reports.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

Assembly: DevExpress.XtraReports.v23.2.Web.dll

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

public interface IDrillThroughProcessor

Remarks

To add drill-through functionality to reports in an application, create a class that implements the IDrillThroughProcessor interface. Its CreateReport method accepts the DrillThroughContext object and returns a report for display. Call the ServiceCollectionServiceExtensions.AddScoped<TService,TImplementation> method to register a custom drill-through processor at application startup.

using System;
using System.Text.Json;
using DevExpress.XtraReports.Services;
using DevExpress.XtraReports.Web.WebDocumentViewer;
// ...
public class NavigateInfo {
    public string NavigateTo { get; set; }
    public string MasterID { get; set; }
}
public class CustomDrillThroughProcessor : IDrillThroughProcessor {
    readonly IReportProvider reportProvider;

    public CustomDrillThroughProcessor(IReportProvider reportProvider) {
        this.reportProvider = reportProvider;
    }
    public DrillThroughResult CreateReport(DrillThroughContext context) {
        NavigateInfo navigateInfo = JsonSerializer.Deserialize<NavigateInfo>(context.CustomData);
        var reportNameToOpen = navigateInfo.NavigateTo == "back" ? "MainReport"
            : navigateInfo.NavigateTo == "details" ? "DetailReport1" : null;
        var report = reportProvider.GetReport(reportNameToOpen, null) ?? context.Report;

        if(navigateInfo.NavigateTo == "details") {
            int catID = 0;
            Int32.TryParse(navigateInfo.MasterID, out catID);
            report.Parameters["categoryID"].Value = catID;
        }
        return new DrillThroughResult(report);
    }
}
See Also