Back to Devexpress

ActionBase.ConfirmationMessage Property

expressappframework-devexpress-dot-expressapp-dot-actions-dot-actionbase-6c0238fc.md

latest5.4 KB
Original Source

ActionBase.ConfirmationMessage Property

Specifies the confirmation message displayed when an end-user executes an Action.

Namespace : DevExpress.ExpressApp.Actions

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
[DefaultValue("")]
public string ConfirmationMessage { get; set; }
vb
<DefaultValue("")>
Public Property ConfirmationMessage As String

Property Value

TypeDefaultDescription
StringString.Empty

A string containing the current Action’s confirmation message.

|

Remarks

When executing an Action, a pop-up window is invoked to display a confirmation message if it is specified by the ConfirmationMessage property. To change an Action’s confirmation message at run time, use the Application Model’s IModelAction.ConfirmationMessage property of the corresponding ActionDesign | Actions | <Action> node. You can do this either via the Model Editor or by accessing the Application Model in code.

You can include the ‘{0}’ format item in the confirmation message. This item will be replaced at run time with either the currently selected object’s caption (if the ActionBase.SelectionDependencyType property is set to RequireSingleObject) or the selected objects count (if the ActionBase.SelectionDependencyType property is set to RequireMultipleObjects). To learn more about formatting confirmation messages, refer to the How to: Modify Action Properties in the Model Editor article.

Tip

To use data from objects that are currently selected by user, follow the approach described in the How to: Access Objects Selected in the Current View example.

The example below adds a confirmation message to a SimpleAction, and if the user confirms, assigns a Contact‘s FirstName value to the NickName property.

csharp
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using MainDemo.Module.BusinessObjects;
// ...
public class SetNickNameController : ObjectViewController<DetailView, Contact> {
    public SetNickNameController() {
        SimpleAction setNickNameAction = new SimpleAction(this, "SetNickName", PredefinedCategory.Edit);
        setNickNameAction.ConfirmationMessage = "Do you want to continue?";
        setNickNameAction.Execute += SetNickNameAction_Execute;
    }
    private void SetNickNameAction_Execute(object sender, SimpleActionExecuteEventArgs e) {
        Contact currentObject = ViewCurrentObject;
        if(currentObject != null) {
            currentObject.NickName = currentObject.FirstName;
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ConfirmationMessage property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

XAF_How-to-get-role-code-from-the-UI/CS/XPO/GenerateRole/GenerateRole.Module/Controllers/RoleGeneratorController.cs#L26

csharp
roleGeneratorAction.Category = "Tools";
roleGeneratorAction.ConfirmationMessage = null;
roleGeneratorAction.Id = "RoleGeneratorAction";

See Also

How the XAF Application Model Works

ActionBase Class

ActionBase Members

DevExpress.ExpressApp.Actions Namespace