<div class="col-sm-6">
<label>Buscar</label>
<SfTextBox Placeholder="Buscar" @bind-Value="@buscarWorks" @onkeypress="@KeyPressHandler" @oninput="@OnTyping"></SfTextBox>
</div>
private void OnTyping(Microsoft.AspNetCore.Components.ChangeEventArgs args)
{
this.buscarWorks = args.Value.ToString();
} |
Is there really no way to use ' @bind-value:event="oninput" ' to handle this?
If this is the case then it seems that binding is not usable if we need to check for enter or do some other processing on each key press. That is very disappointing.
Also, would it be better to use @onkeyup instead of @onkeypress so that we are sure the value has been saved before that event gets triggered?
Hi,
I had a similar problem and found following, which may help:
https://stackoverflow.com/questions/63861068/blazor-how-can-i-trigger-the-enter-key-event-to-action-a-button-function
So maybe changing the outer <div> to a <form> and using the "onsubmit"-Event on the form.
I hope, this helps.
Regards,
Pascal
Hi Pascal,
Thanks for your suggestion.
Regards,
Sureshkumar P