menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfDialogProvider - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfDialogProvider

    The DialogProvider component serves as a target container where built-in dialogs are rendered using ConfirmAsync(String, String, DialogOptions), AlertAsync(String, String, DialogOptions), and PromptAsync(String, String, DialogOptions) methods from the SfDialogService.

    Inheritance
    System.Object
    SfDialogProvider
    Namespace: Syncfusion.Blazor.Popups
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfDialogProvider : ComponentBase
    Remarks

    It is recommended to add this component in MainLayout.razor to enable utility dialogs to be displayed from anywhere in the application. If you add this component to a specific page, the utility dialogs will only be available for that particular page. The component automatically handles the lifecycle of dialogs created through the SfDialogService, including their opening, closing, and result handling.

    Examples

    Adding the DialogProvider component to your application layout.

    @* In MainLayout.razor *@
    <div class="page">
        <div class="sidebar">
            <NavMenu />
        </div>
        <main>
            <div class="top-row px-4">
                <a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
            </div>
            <article class="content px-4">
                @Body
            </article>
        </main>
    </div>
    <SfDialogProvider />

    Constructors

    SfDialogProvider()

    Declaration
    public SfDialogProvider()

    Methods

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    Dispose()

    Releases all resources used by the SfDialogProvider component.

    Declaration
    public void Dispose()
    Remarks

    This method unsubscribes from the Syncfusion.Blazor.Popups.SfDialogService.OnOpen event to prevent memory leaks. It is automatically called when the component is disposed by the Blazor framework.

    OnInitialized()

    Initializes the component and subscribes to the dialog service events.

    Declaration
    protected override void OnInitialized()
    Remarks

    This method is called once when the component is first initialized. It subscribes to the Syncfusion.Blazor.Popups.SfDialogService.OnOpen event to handle dialog requests from the service.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved