BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Here is the relevant code:
<SfAutoComplete @ref="GrowerAutoComplete"
TValue="GrowerModel"
TItem="GrowerModel"
Placeholder="Any part of Grower Name"
DataSource="@growers"
Autofill=true
Highlight=true
Created="@onCreate"
@bind-Value="@Grower">
<AutoCompleteFieldSettings Value="NameForCbo" />
</SfAutoComplete>
private async Task onCreate()
{
int x; // I placed a breakpoint here and it does not reach this line.
}
Is this a bug? Or am I doing something wrong. I pulled the code from a forum solution, so it looks like it SHOULD work -- unless maybe the Created event doesn't exist for autocomplete?
My goal is to set focus to this. It's in a form that doesn't render until a variable is set. The form is part of a page.
I tried putting the FocusAsync command in the method that sets the variable that causes the form to render, but the line tries to run before the form has a chance to render. That's why I tried the Created event.
You have to place the Created event on the <AutoCompleteEvents> instead of the <SfAutoComplete> as in below code snippet. Please refer to the documentation for more information.
<SfAutoComplete @ref="GrowerAutoComplete" TValue="GrowerModel" TItem="GrowerModel" Placeholder="Any part of Grower Name" DataSource="@growers" Autofill=true Highlight=true @bind-Value="@Grower"> <AutoCompleteFieldSettings Value="NameForCbo" /> <AutoCompleteEvents TItem="GrowerModel" TValue="GrowerModel" Created="@onCreate"></AutoCompleteEvents> </SfAutoComplete> |
Documentation: https://blazor.syncfusion.com/documentation/autocomplete/events#created
Yep. That was the key part I missed. Thanks!
We are happy to assist you. Please get back to us if you need any further assistance on this.