ComboBox error on inserting invalid value

Hello,

I'm reporting a problem with the ComboBox control:

In combobox binded with an int? value, writing an invalid string inside the combobox and clicking outside in the page, the control throws an exception, stopping the entrie blazor app.
I think the correct behavior is to set the int? value as null.

I've attached a video to reproduce the problem and a sample project to test it.

Version: 18.3.0.48

Thank you

Attachment: ComboBoxTest_d1423627.zip

1 Reply 1 reply marked as answer

SN Sevvandhi Nagulan Syncfusion Team November 16, 2020 11:37 AM UTC

Hi Fabrizio,  
  

Greetings from Syncfusion support.  
  

Since volume 3 2020 release, when enabled the AllowCustom, the Value field and Value must be string type. Otherwise, you need to send the Item in CustomValueSpecifier event. Kindly refer to the following code.  

<SfComboBox TValue="int?" TItem="GameFields" PopupHeight="230px" Placeholder="Select a game" @bind-Value="@DropVal" DataSource="@Games"> 
            <ComboBoxEvents TValue="int?" TItem="GameFields" ValueChange="OnChange" CustomValueSpecifier="@customValue"></ComboBoxEvents> 
            <ComboBoxFieldSettings Text="Text" Value="ID"></ComboBoxFieldSettings> 
 </SfComboBox> 
 
 
    private void customValue(CustomValueSpecifierEventArgs<GameFields> args) 
    { 
        args.Item = new GameFields() { ID = 10, Text = args.Text }; 
    } 

  
Kindly refer to the following release notes content for the changes  




Let us know if you need any further assistance on this.  


Regards,  
Sevvandhi N 


Marked as answer
Loader.
Up arrow icon