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

MudAutoComplete : Problem to get current text without any suggest selection

$
0
0

I'm using MudAutoComplete to implement suggestions based on user entering text, It works perfectly.My problem is that when user write a text & press Enter, in KeyDown eventHandler i've get the first suggestion in the list instead of current text which user entered!!For example, when user enter "Alfki", The following suggestions show :Hi AlfkiAlfki Bye..Alfki Bye 2

Now, when user hit Enter after Alfki, In KeyDown eventHandler, I've got "Hi Alfki" in bound-value instead of "Alfki"!Where is my problem and how to solve it?Thanks ...

Updated ..Here is my sample code :

<MudAutocomplete T="string"                  Variant="Variant.Outlined"                 @ref="@_txtAutoCompelete"                 ResetValueOnEmptyText="true"                 CoerceText="true"                 @bind-Text="_strSearchQuery"                 SearchFunc="@SearchQuery"                 OnKeyUp="@SearchQueryResult"                 Adornment="Adornment.End"                 AdornmentIcon="@Icons.Filled.Search"                 AdornmentColor="Color.Success"></MudAutocomplete>@code{private string _strSearchQuery;    private async Task SearchQueryResult(KeyboardEventArgs e)    {            if (e.Code == "Enter" || e.Code == "NumpadEnter")            {                    string strText = _txtAutoCompelete.Text; // first suggestion, not current text!                    string strValue = _txtAutoCompelete.Value; // first suggestion, not current text!                    string strCurrentText = _strSearchQuery; // first suggestion, not current text!            }    }}

Viewing all articles
Browse latest Browse all 4269

Trending Articles



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