Back to Devexpress

IToastNotificationService.CloseToast(String) Method

blazor-devexpress-dot-blazor-dot-itoastnotificationservice-dot-closetoast-x28-system-dot-string-x29.md

latest1.4 KB
Original Source

IToastNotificationService.CloseToast(String) Method

Closes a toast notification with the specified identifier.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
void CloseToast(
    string id
)

Parameters

NameTypeDescription
idString

The toast identifier.

|

Remarks

Call the CloseToast method to close a toast with the specified Id property value.

razor
<DxButton Text="Show a toast" Click="AddToast" />
<DxButton Text="Hide a toast" Click="HideToast" />
<DxToastProvider DisplayTime="@TimeSpan.Zero" />
@code {
    [Inject] IToastNotificationService ToastService { get; set; }

    private void AddToast() {
        ToastService.ShowToast(new ToastOptions {
            Id = "TaskNotification",
            Title = "Notification",
            Text = "The process is completed.",
        });
    }
    private void HideToast() {
        ToastService.CloseToast("TaskNotification");
    }
}

See Also

IToastNotificationService Interface

IToastNotificationService Members

DevExpress.Blazor Namespace