学习010-05-04 How to: Disable a Confirmation Dialog in an ASP.NET Core Blazor Application(如何:在 ASP.NET

How to: Disable a Confirmation Dialog in an ASP.NET Core Blazor Application(如何:在 ASP.NET Core Blazor 应用程序中禁用确认对话框)

In XAF ASP.NET Core Blazor applications, a confirmation dialog appears if you attempt to exit a view without saving your changes. The following Controllers implement this functionality:
在XAFASP.NETCore Blazor应用程序中,如果您尝试退出视图而不保存更改,则会出现一个确认对话框。以下控制器实现此功能:

  • ConfirmationDetailViewController in Detail Views.
    ConfirmationDetailViewController详细视图。
  • ConfirmationListViewController in List Views.
    列表视图中的ConfirmationListViewController。

This topic demonstrates how to disable the confirmation dialog in a Detail View.
本主题演示如何在详细信息视图中禁用确认对话框。

Step-by-Step Instructions(分步说明)

1.In the YourSolutionName.Blazor.Server\Controllers folder, create a new Controller and name it BlazorSuppressConfirmationsController.
在YourSolutionName. Blazor.Server\Controller文件夹中,创建一个新的Controller并将其命名为BlazorSuppressConfirmationsController。

2.Replace the auto-generated code with the following code snippet:
将自动生成的代码替换为以下代码片段:

C#
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Blazor.SystemModule;

namespace MainDemo.Module.Blazor.Controllers {
    public class BlazorSuppressConfirmationsController : ViewController {
        protected override void OnActivated() {
            base.OnActivated();
                var confirmationDetailViewController = Frame.GetController<ConfirmationDetailViewController>();
                if (confirmationDetailViewController != null) {
                    confirmationDetailViewController.Active["DeactivateInCode"] = false;
            }
        }
    }
}

Build the project and run the application. Open a Detail View and change a property value. When you close the view, XAF does not save the changes and the confirmation dialog does not appear.
构建项目并运行应用程序。打开详细信息视图并更改属性值。关闭视图时,XAF不会保存更改,也不会出现确认对话框。

Tip
The ConfirmationDetailViewController and ConfirmationListViewController are active for non-persistent objects only if the AutoSetModifiedOnObjectChange property is set to true.
仅当AutoSetModifiedOnObjectChange属性设置为true时,ConfirmationDetailViewController和ConfirmationListViewController才对非持久性对象有效。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汤姆•猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值