https://razor.radzen.com/dialog

@page "/radzentest"

@inject DialogService DialogService


<h3 style="margin-top: 20px;">Simple Dialog</h3>
<RadzenButton Text="Show dialog with inline Blazor content" Click=@ShowInlineDialog />
<h3 style="margin-top: 20px;">Confirm Dialog</h3>
<RadzenButton Text="Show confirm dialog" Click=@(args => DialogService.Confirm("Are you sure?", "MyTitle", new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No" })) />


@code {
 
    
    protected override void OnInitialized()
    {
        DialogService.OnOpen += Open;
        DialogService.OnClose += Close;
    }

    void Open(string title, Type type, Dictionary<string, object> parameters, DialogOptions options)
    {
       
    }

    void Close(dynamic result)
    {
        
    }

    async Task ShowInlineDialog() => await DialogService.OpenAsync("Simple Dialog", ds =>
    @<div>
        <p Style="margin-bottom: 1rem">Confirm?</p>
        <div class="row">
            <div class="col-md-12">
                <RadzenButton Text="Ok" Click="() => ds.Close(true)" Style="margin-bottom: 10px; width: 150px" />
                <RadzenButton Text="Cancel" Click="() => ds.Close(false)" ButtonStyle="ButtonStyle.Secondary" Style="margin-bottom: 10px; width: 150px" />
            </div>
        </div>
    </div>);
}
Last modified: December 6, 2020

Author

Comments

Write a Reply or Comment