How to know specific data exist in sfcombobox.


Hello, 

It is not able to cast change sfcombobox to datatable. 

so, i want to know specific data is exist or not in sfcombobox. 


Thanks.



1 Reply 1 reply marked as answer

SS Suganya Sethuraman Syncfusion Team March 29, 2021 07:08 AM UTC

Hi Min,

Greetings from Syncfusion.

We have analyzed your requirement. We have prepared sample based on your requirement. As shown in the code snippet below, we dynamically added data that was not in the DataSource in this sample.

Code snippet
 
private void Button_Clicked(object sender, EventArgs e) 
{ 
              int count = viewModel.EmployeeCollection.Count; 
              bool isAdded = false; 
              foreach (var item in viewModel.Collection) 
              { 
                             isAdded = false; 
                             for (int i = 0; i < count; i++) 
                             { 
                                           if (viewModel.EmployeeCollection[i].Name.Contains(item.Name)) 
                                           { 
                                                          isAdded = true; 
                                           } 
                             } 
 
                             if (!isAdded) 
                             { 
                                           viewModel.EmployeeCollection.Add(item); 
                             } 
              } 
} 

Please check if the sample satisfies your requirement and let us know if you have any concerns.

Regards,
Suganya Sethuraman.
 


Marked as answer
Loader.
Up arrow icon