When using
<p>ComboBox Text is:<strong>@text</strong></p>
<SfComboBox @ref="comboboxObj" TValue="int" TItem="Countries" ShowClearButton="false" Placeholder="e.g. Australia" @bind-Value="@ComboVal" DataSource="@Country">
<ComboBoxFieldSettings Text="Name" Value="Code"></ComboBoxFieldSettings>
<ComboBoxEvents TValue="int" TItem="Countries" ValueChange="onChange"></ComboBoxEvents>
</SfComboBox>
@code {
SfComboBox<int, Countries> comboboxObj;
public int ComboVal = 1;
public string text;
public class Countries
{
public string Name { get; set; }
public int Code { get; set; }
}
List<Countries> Country = new List<Countries>
{
new Countries() { Name = "Australia", Code = 1 },
new Countries() { Name = "Bermuda", Code = 2 },
new Countries() { Name = "Canada", Code = 3 },
new Countries() { Name = "Cameroon", Code= 4 },
};
public void onChange(ChangeEventArgs<int, Countries> e)
{
text = this.comboboxObj.Text;
}
}
Every thing works fine.
Add Autofill="true" and start typing in combobox and it thows
2020-10-19T20:34:06.546Z] Error: System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Int32'.
at Syncfusion.Blazor.DropDowns.SfComboBox`2.SetAutoFill(TItem activeItem)
at Syncfusion.Blazor.DropDowns.SfComboBox`2.InlineSearch(KeyboardEventArgs args)
at Syncfusion.Blazor.DropDowns.SfComboBox`2.IncrementSearch(KeyboardEventArgs args)
at Syncfusion.Blazor.DropDowns.SfComboBox`2.SearchList(KeyboardEventArgs args)
at Syncfusion.Blazor.DropDowns.SfDropDownList`2.OnFilterUp(KeyboardEventArgs args)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
e.log @ blazor.server.js:19
blazor.server.js:1 [2020-10-19T20:34:06.548Z] Information: Connection disconnected.
2blazor.server.js:1 Uncaught (in promise) Error: Cannot send data if the connection is not in the 'Connected' State.
at e.send (blazor.server.js:1)
at e.sendMessage (blazor.server.js:1)
at e.sendWithProtocol (blazor.server.js:1)
at e.send (blazor.server.js:1)
at blazor.server.js:8
at Object.t.dispatchEvent (blazor.server.js:8)
at blazor.server.js:8
at e.onEvent (blazor.server.js:8)
at e.onGlobalEvent (blazor.server.js:8)