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

IDialogService.AlertAsync(MessageBoxOptions) Method

Shows an alert dialog (message box).

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
Task AlertAsync(
    MessageBoxOptions messageBoxOptions
)

#Parameters

Name Type Description
messageBoxOptions MessageBoxOptions

An object that contains message box options.

#Returns

Type Description
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
        });
    }
}

Message Box

See Also