Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blazor text is not changed immediately upon insertion

I have an application where the user can insert text at a certain location. The text is shown on a badge on the same page. What I want is that as the user types the changes are immediately displayed in the badge. I have added an oninput event, but it seems that the oninput event does not update the razor page because the badge remains blank when I have input changes. The text is only displayed when the focus is lost on TextField.

How can I make it so that when I insert letters, they are immediately displayed on the badge?

Textinput:

<MudTextField @bind-Value="@itemAttribute.Title" @oninput="(e)=> itemAttribute.Title = e.Value.ToString()" />

Badge:

<MudBadge Overlap="false" Style="@($"color: #CFD8DC;")" Color="Color.Transparent" Content="@itemAttribute.Title">

Variable:

 [Parameter] public ItemAttribute itemAttribute { get; set; }
like image 922
T0bi Avatar asked Sep 11 '25 14:09

T0bi


1 Answers

Try simply:

<MudTextField @bind-Value="@itemAttribute.Title" Immediate="true" />
like image 69
Nicola Biada Avatar answered Sep 13 '25 03:09

Nicola Biada