ActionBase.ConfirmationMessage Property
Specifies the confirmation message displayed when an end-user executes an Action.
Namespace: DevExpress.ExpressApp.Actions
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Property Value
Type | Default | Description |
---|---|---|
String | String.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.
In Windows Forms applications, the confirmation dialog contains “Yes” and “No” buttons. Meantime, in ASP.NET Web Forms applications, the buttons are “OK” and “Cancel”. Keep this fact in mind when composing text for the ConfirmationMessage property.
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.
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;
}
}
}