How to: Specify the Default Name for User-Defined Reports 如何:指定用户定义的报表的默认名称

This example demonstrates how to change the default name of user-defined reports in WinForms and ASP.NET applications. Mobile applications do not allow user to create a new report in runtime, so the approach described in this topic cannot be implemented in the Mobile platform.

此示例演示如何更改 WinForms 和ASP.NET应用程序中的用户定义报表的默认名称。移动应用程序不允许用户在运行时创建新报表,因此本主题中描述的方法无法在移动平台中实现。

 

In this topic, it is assumed that you have an XAF application that uses the Reports V2 Module, and you have created one or more reports (see Reports V2 Module Overview).

在本主题中,假定您有一个使用报表 V2 模块的 XAF 应用程序,并且您创建了一个或多个报表(请参阅报表 V2 模块概述)。

 

In the Module.cs (Module.vb) file, override the ModuleBase.Setup method and handle the static ReportServiceController.QueryRootReportComponentName event to change the default name of user-defined reports. In the event handler, assign the new name to the Name parameter and set the Handled parameter to true.

在Module.cs (module.vb) 文件中,重写 ModuleBase.安装程序方法并处理静态报表服务控制器.查询根报表组件名称事件以更改用户定义的报表的默认名称。在事件处理程序中,将新名称分配给 Name 参数并将 Handled 参数设置为 true。

复制代码
using DevExpress.ExpressApp.ReportsV2;
// ...
public override void Setup(XafApplication application) {
    ReportServiceController.QueryRootReportComponentName +=
        delegate(object sender, QueryRootReportComponentNameEventArgs e) {
        e.Handled = true;
        e.Name = "MyNewReport";
    };
    base.Setup(application);
}
复制代码

 

The result is demonstrated in the image below.

结果如下图所示。

WinForms:

ReportsV2_QueryRootReportComponentName

ASP.NET:

ReportsV2_QueryRootReportComponentName_Web

 

posted @   code first life  阅读(209)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示