Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Disable a Confirmation Dialog in an ASP.NET Core Blazor Application

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:

  • ConfirmationDetailViewController in Detail Views.
  • ConfirmationListViewController in List Views.

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.
  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;
                }
            }
        }
    }
    
  3. 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.

Tip

The ConfirmationDetailViewController and ConfirmationListViewController are active for non-persistent objects only if the AutoSetModifiedOnObjectChange property is set to true.

See Also