IDialogService.ConfirmAsync(MessageBoxOptions, RenderFragment) Method
Shows a confirmation dialog (message box).
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v26.1.dll
Declaration
Task<bool> ConfirmAsync(
MessageBoxOptions messageBoxOptions,
RenderFragment childContent = null
)
Parameters
| Name | Type | Description |
|---|---|---|
| messageBoxOptions | MessageBoxOptions | An object that contains message box options. |
Optional Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| childContent | RenderFragment | null | Custom content displayed in the message box body. |
Returns
| Type | Description |
|---|---|
| Task<Boolean> | The task that completes when the dialog closes. |
Remarks
Call the ConfirmAsync method to show a Confirmation type message box. Use the method parameter to specify message box settings.
<DxDialogProvider />
<DxButton Text="Show a message box window" Click="@OpenConfirmDialogAsync" />
@code {
[Inject] IDialogService DialogService { get; set; }
private bool? Result { get; set; } = null;
private async Task OpenConfirmDialogAsync() {
Result = await DialogService.ConfirmAsync(new MessageBoxOptions() {
Title = "Error",
Text = "Unable to process the request. Please try again later or contact support.",
RenderStyle = MessageBoxRenderStyle.Danger,
OkButtonText = "Contact Support",
CancelButtonText = "Try Later",
});
}
}

Display Custom Content
To display custom content in a message box created by the dialog service, pass a RenderFragment to the ConfirmAsync(MessageBoxOptions, RenderFragment) method.
<DxDialogProvider />
<DxButton Text="Delete Files" Click="@OpenConfirmDialogAsync" />
@code {
[Inject] IDialogService DialogService { get; set; }
private bool? Result { get; set; }
private async Task OpenConfirmDialogAsync() {
Result = await DialogService.ConfirmAsync(
new MessageBoxOptions() {
Title = "Confirm Deletion",
OkButtonText = "Delete",
CancelButtonText = "Cancel",
RenderStyle = MessageBoxRenderStyle.Danger
},
@<div>
<p>The following files will be permanently deleted:</p>
<ul>
<li>report_2025.pdf</li>
<li>invoice_march.xlsx</li>
<li>backup_data.zip</li>
</ul>
<p>This action cannot be undone.</p>
</div>
);
}
}
