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

How do I programmatically change a value in a Blazor button parameter?

$
0
0

We have an AutoComplete user entry field that will take up to 6 numbers, displaying any matching numbers as the user types. When the user sees the number in the drop-down box they want to display, they click it and then click the Search button. However, if the user types a number that is not on the database, they have to click the Search button twice to proceed with processing. They find this annoying and want us to fix it so that only one click is necessary.

Now my theory is that clicking the number from the drop-down box constitutes the first click, and the click on the Search button the second. They don't like that answer and want me to ease their pain!

<AutoComplete id=AutoCompleteProviderNumber" @ref="autocompleteRef"                      T="string" Label="Provider Number"                      SearchFunc="@SearchProviderNumbers"                       @bind-Value="@model.ProviderNumber"                       Inputprops="new InputType {OnInput = HandleInput}                      AutoFocus="true"                      TextChanged="OnTextChanged"                      SelectionOnActivation=:false"</AutoComplete><ActionButton id="MudButtonSearch"                      AutoFocus="false"                      ButtonType="ButtonType.Submit"                      Disabled="@(!context.Validate() || model.ProviderNumber == null)"            Search</ActionButton>    .    .    .    private async Task<IEnumerable<string>> SearchProviderNumbers(string providerNumber, CancellationToken token)    {       var result = (IEnumerable<string>) dtoConfig.ProviderNumbersSearchData            v.Where(x => x.StartsWith(providerNumber, StringComparison.InvariantCultureIgnoreCase)).ToList();        if(providerNumber.Length == 6)        {            if(result.Count() == 0)            {                //do something to change AutoFocus Search button to true             }        }    return result;}

I have tried several things to change the AutoFocus parameter to true, but nothing has worked. Does anyone have any suggestions?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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