Back to Devexpress

IDialogService.AlertAsync(MessageBoxOptions) Method

blazor-devexpress-dot-blazor-dot-idialogservice-dot-alertasync-x28-devexpress-dot-blazor-dot-messageboxoptions-x29.md

latest1.8 KB
Original Source

IDialogService.AlertAsync(MessageBoxOptions) Method

Shows an alert dialog (message box).

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
Task AlertAsync(
    MessageBoxOptions messageBoxOptions
)

Parameters

NameTypeDescription
messageBoxOptionsMessageBoxOptions

An object that contains message box options.

|

Returns

TypeDescription
Task

The task that is completed when the dialog is closed.

|

Remarks

Call the AlertAsync method to show a message box of the Alert type in code. Use the method parameter to set up the message box settings.

Run Demo: Message Box - Dialog Service

razor
<DxDialogProvider />
<DxButton Text="Show a message box window" Click="@OpenConfirmDialogAsync" />

@code {
    [Inject] IDialogService DialogService { get; set; }

    private async Task OpenConfirmDialogAsync() {
        await DialogService.AlertAsync(new MessageBoxOptions() {
            Title = "Error",
            Text = "Unable to process the request. Please try again later or contact support.",
            RenderStyle = MessageBoxRenderStyle.Danger
        });
    }
}

See Also

IDialogService Interface

IDialogService Members

DevExpress.Blazor Namespace