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

Blazor Server - MudBlazor - MudTextField bind value not updating

$
0
0

The MudTextField is bound to variable chatInput. Once user inputs their query and hits Enter, HandleKeyUp() is called. In that method, we grab the value of the query and then clear the field and attempt to update the state. The variable bound to the field changes to an empty value in debug, however the UI does not clear the text. We want the text clear, so the user can more easily type another query there.

Tech Stack: Blazor Server, MudBlazor, C#.

// Clear the input   chatInput = string.Empty;// Trigger UI update to clear the input field   await InvokeAsync(StateHasChanged);//Part of the MudBlazor element MudTextField @bind-Value="chatInput" Placeholder="Type a message" @bind-Value:after="@(() => InvokeAsync(StateHasChanged))"   @onkeyup="HandleKeyUp"

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>