Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor binding problem : upgraded from .NET 9 to .NET 10

$
0
0

We upgraded our ASP.NET Core Blazor application from .NET 9 to .NET 10 and we are experiencing a wierd problem and cant find a solution for it.

The setup is InteractiveServer and is follows :

  1. A web page has a button (Component we made). When this button is clicked, a confirmation pop up (written in the Button component) is shown

  2. When the button is pressed again, the confirmation message is lost for some reason and this is only happening after upgrade to .NET 10.

Form that uses the following to display button:

<Button Id="CreateAndSendButton" OnClick="ShowCreateDialog" Enabled="CanCreate" Style="ButtonStyle.Secondary">Create and Send</Button>

Scripts below for button.razor:

<button type="@Type.ToString()" id="@Id" class="@($"text-nowrap {@_cssClass}")" @onclick="Submit" disabled="@(!Enabled)" title="@ToolTip" form="@Form"><i class="@IconClass"></i></button>    @if (!string.IsNullOrEmpty(ConfirmationMessage))    {<ModalDialog @ref="_confirmationDialog" id="@($"{@Id}_ConfirmationDialog")" Title="@ConfirmationTitle" Message="@ConfirmationMessage" OnSubmit=@SubmitConfirmed ShowSubmitButton="true" SubmitButtonText="Yes" ShowCloseButton="true" CloseButtonText="No"></ModalDialog>    }

When the button is clicked, the following code is called:

private async Task ShowCreateDialog(){    var result = await called Service;    if (result.Success)    {        await ReloadData();    }}private async Task ReloadData(){    await InvokeAsync(StateHasChanged);}

Within the button

private async Task Submit(){    await _confirmationDialog.Show();}

In the modal dialog:

[Parameter] public string Message { get; set; }[Parameter] public EventCallback OnSubmit { get; set; }public async Task Show(){    await InvokeAsync(StateHasChanged);}

Problem is that for some reason, Message becomes empty when the button is clicked again.


Viewing all articles
Browse latest Browse all 4839

Trending Articles