Combo box does not display binded value

Hello,

When binding value to the combo box it is not displayed. Example:
@Test
                    <div class="row">
                        <label for="Reporter" class="col-sm-2 col-form-label form-header-name">Test</label>
                        <div class="col-sm-6">
                            <SfComboBox AllowCustom=@true
                                        TItem="string"
                                        AllowFiltering=@true
                                        TValue="string"
                                        @[email protected]
                                        [email protected]
                                        Placeholder="Select an item">
                            </SfComboBox>
                        </div>
                    </div>
@code{
public string Test { get; set; } = "Ivan";

    public List<string> Values { get; set; } = new List<string> { "item1", "item2", "item3" };
}

5 Replies

BC Berly Christopher Syncfusion Team April 8, 2020 01:42 PM UTC

Hi Krasimir, 
  
Greetings from Syncfusion support.  
  
We have confirmed the reported issue “Custom value is not being set in the combobox when provided as initial value in the component” as a bug at our end and this fix will be included in our patch release scheduled on 22nd April 2020. You can track the status of the reported issue from the below feedback link. 
  
  
Also, we suggest you to add the custom value in the data source to achieve the requested requirement until the patch release has been rolled out. Also, we suggest you to define the data source as ObservableCollection instead of List to reflect the data source with dynamically added value. Kindly refer the below code example.  
  
@using System.Collections.ObjectModel 
<div class="row"> 
    <label for="Reporter" class="col-sm-2 col-form-label form-header-name">Test</label> 
    <div class="col-sm-6"> 
        <SfComboBox @ref="ComboObj" AllowCustom=@true 
                    TItem="string" 
                    AllowFiltering=@true 
                    TValue="string" 
                    @bind-Value=@this.Test 
                    DataSource=@this.Values 
                    Placeholder="Select an item"> 
            <ComboBoxEvents TValue="string" Created="OnCreated"></ComboBoxEvents> 
        </SfComboBox> 
    </div> 
</div> 
@code{ 
    SfComboBox<string, string> ComboObj; 
    public string Test { get; set; } = "Ivan"; 
 
    public ObservableCollection<stringValues { getset; } = new ObservableCollection<string> { "item1""item2""item3" }; 
 
    public void OnCreated() 
    { 
        this.Values.Add("Ivan"); 
    } 
 
} 

  
Please find the sample from the below link. 
  
Regards, 
Berly B.C 



KI Krasimir Ivanov April 8, 2020 01:45 PM UTC

Ok, thank you for the workaround.


BC Berly Christopher Syncfusion Team April 8, 2020 02:47 PM UTC

Hi Krasimir, 
  
Thanks for the update. Please let us know if you need further assistance on this.  
  
Regards, 
Berly B.C 



SA Sarah May 2, 2024 06:38 AM UTC

Hello

I have this problem in version 25.1.35



YS Yohapuja Selvakumaran Syncfusion Team May 3, 2024 11:39 AM UTC


Hi Sarah,


Thank you for getting back to us. After conducting thorough validation in version 25.1.25, we are pleased to inform you that the reported issue has not occurs, and the custom value properly binds to the component. To provide you with further reference and assistance, we have prepared a sample for your review in the version 25.1.35:



Sample: https://blazorplayground.syncfusion.com/VNrfNeNqTiyssIjV




If you encounter the same issue persisting, we kindly request you to modify the shared sample to replicate the issue on our end. Additionally, if the issue appears under specific circumstances, please provide us with the relevant details so that we can conduct further investigation and assist you effectively.




Regards,

Yohapuja S


Loader.
Up arrow icon