Hi Amar,
We let you know that
the SfAutocomplete component does not
support ValueTemplate functionalities. So, we suggest using
the SfDropDownList component to achieve your requirement.
In the below sample, we have rendered
the SfDropDownList component with ValueTemplate and enabled
the AllowFiltering property. This property is used to search the
results based on typed input. Please find the below code and sample for your
reference.
|
<SfDropDownList
TValue="string"
TItem="EmployeeData" Placeholder="Select
a customer" AllowFiltering="true" Query="@Query">
<DropDownListTemplates
TItem="EmployeeData">
<ItemTemplate>
<span><span class='name'>@((context as EmployeeData).FirstName)</span><span class='destination'>@((context as EmployeeData).Designation)</span></span>
</ItemTemplate>
<ValueTemplate>
<span>@((context as EmployeeData).FirstName)
- @((context as EmployeeData).Designation)</span>
</ValueTemplate>
</DropDownListTemplates>
<SfDataManager
Url="https://ej2services.syncfusion.com/production/web-services/api/Employees" Adaptor="Syncfusion.Blazor.Adaptors.WebApiAdaptor" CrossDomain="true"></SfDataManager>
<DropDownListFieldSettings Text="FirstName"
Value="Designation"></DropDownListFieldSettings>
</SfDropDownList>
|
We have attached
sample for your reference.
Regards,
Mohanraj M
Attachment:
Valuetemplate_23aec47a.zip