Radzen Nested Dialog Box issue

I am having with Radzen DialogBox.

Initial dialog box call:

var parameters = new Dictionary<string, object>
{
    {"Transaction", Transaction_Model },
    {"Payment", null },
    {"Connection", conn },
    {"SqlTransaction", transaction }
};

var dialogResult = await DialogService.OpenAsync<PaymentDialog>("Payment", parameters, new DialogOptions { Width = "1100px", Height = "700px", Draggable = true, Resizable = true });
            

I have below code inside dialog box:

@foreach (var item in templateData)
{
                <RadzenButton class="product-remove-button" Icon="remove" Size="ButtonSize.Small" Click=@(() => RemoveTransactionItem(item))>βœ–</RadzenButton>
            </span>
            <span class="quantity">@(item.Quantity) x</span>
            <span class="product-name">
                @{
                        @(item.Short_Name)
                }
            </span>
        </div>
    </div>
}

Then I have below confirmation dialog when user tries to remove. When I call confirmation inside dialog box the data is lost from the original dialog box. Means it resets the dialogbox state.

private async void RemoveTransactionItem(TransactionItemModel? transactionItem)
{
    var dialogResult = await DialogService.Confirm(DialogMessages.Delete_Confirmation_Message.Message, DialogMessages.Delete_Confirmation_Message.Title, new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No" });

    if (dialogResult == true)
    {
        
    }
}

Not sure what data are lost - there is no such thing as dialog state also. Try to debug your application to check what’s causing the problem - alternatively if you believe there is a problem with our component feel free to demonstrate it using our demos, they are editable.

I believe I am facing issue same as this github issue (DialogService OpenAsync & Close in a second/nested Dialog causes reinitialization and state loss of first/parent Dialog Β· Issue #174 Β· radzenhq/radzen-blazor Β· GitHub)

We can see that before initiating nested dialog Payment object has data but when confirmation dialog is called Payment object is set to null, it's like dialog has reset to original state.

Nested dialog issue

If you have active subscription you can send us an example application demonstrating the problem at info@radzen.com.

I don't have active subscription but I believe this is a bug in Radzen Dialog Component. I will look into it more and see if I can find why it's happening.

You have full access to our source code and can debug it together with your application.

1 Like