How to: Access the Report Preview Control (ASP.NET Core Blazor)(如何:访问报表预览控件(ASP.NET Core Blazor))

This example accesses the DxDocumentViewer component that ASP.NET Core Blazor XAF applications use to display reports.
此示例访问ASP.NET Core Blazor XAF应用程序用于显示报表的DxDocumentViewer组件。

When a user previews a report, an XAF ASP.NET Core Blazor application opens a Detail View that contains a ReportViewerViewItem. Follow the steps below to access this View Item and its component:
当用户预览报表时,XAF ASP.NET Core Blazor 应用程序会打开一个包含 ReportViewerViewItem 的明细视图。请按照以下步骤访问此视图项及其组件:

1.Add the Reports V2 Module to your application. For more information, refer to the following topic: Add Reports V2 Module to an Existing XAF Application.
将报表V2模块添加到您的应用程序中。有关更多信息,请参阅以下主题:将报表V2模块添加到现有XAF应用程序。

2.Create a Detail View Controller and specify the TargetViewId as ReportsBlazorModuleV2.ReportViewerDetailViewName.
创建一个详情视图控制器,并将TargetViewId指定为ReportsBlazorModuleV2.ReportViewerDetailViewName。

3.Override the OnActivated method and access the Report Viewer’s control as demonstrated in the following code snippet:
重写OnActivated方法,并按以下代码片段所示访问报表查看器的控件:

C#
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.ReportsV2.Blazor;
using DevExpress.XtraReports;




namespace YourSolutionName.Blazor.Server.Controllers;




public class AccessReportViewerController : ViewController<DetailView> {




    public AccessReportViewerController() {
        TargetViewId = ReportsBlazorModuleV2.ReportViewerDetailViewName;
    }




    protected override void OnActivated() {
        base.OnActivated();
        View.CustomizeViewItemControl<ReportViewerViewItem>(this, CustomizeReportViewerViewItem);
    }




    private void CustomizeReportViewerViewItem(ReportViewerViewItem reportViewerViewItem) {
        //Access the Report Viewer's control.
        IReport report = reportViewerViewItem.ReportViewerModel.Report;
        // ...
    }
}
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐