We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

I want to clean up a SfComboBox from the selected values

I would like to do what with the traditional combobox is done with the command:
comboBox.SelectedIndex = -1;
In that case the text is cleaned up and the combobox is in the initial state as if there had been no selection.
I can do this when loading the form with SfComboBox.
But if I make a selection after I can no longer clean up the SfComboBox .
It gives me the error: index -1 not valid, it accepts only positive values and greater than 0

thanks

Maurizio

14 Replies

AA Arulraj A Syncfusion Team December 12, 2018 08:47 AM UTC

Hi Maurizio, 

Thanks for using Syncfusion product. 

We can reproduce your reported scenario. We have confirmed this is a bug so we have logged the bug report for this issue “SfComboBox not clear the selected value when resetting the SelectedIndex” and it will be available on our upcoming main release 2018 Volume 4 which will be expected at end of this December 2018. 

Moreover, you can resolve this issue by using TextBox.Clear method. Please refer the following code example and the sample. 

Code example 
this.sfComboBox1.TextBox.Clear(); 


Arulraj A 



SS Shankar Sharma February 23, 2021 12:47 PM UTC

Hi Syncfusion Team,

Any update on above concern, Also I am still not able to clear/reset the SfComboBox selected value by  using SelectedIndex = -1

Looking forward to hearing from you at earliest.

Thanks!


EM Elakkiya Muthukumarasamy Syncfusion Team February 25, 2021 09:10 AM UTC

Hi Shankar, 
 
Thanks for your patience. 
 
We have checked your reported issue “SfComboBox not clear the selected value when resetting the SelectedIndex” with the latest release version 18.4.0.44.While setting the SFComboBox SelectedIndex is -1 the text clear properly without throwing the exception. Please refer the below sample for the same. 
 
 
Please try it with the provided sample and if you still facing this issue please share us your currently using syncfusion product version details, we will check and update you the prompt solution based on it. 
 
 
Regards, 
Elakkiya 



AH Andrew Hoke May 11, 2021 07:41 PM UTC

I can also confirm that the selected value is not being cleared when the SfComboBox SelectedIndex is set to -1.

Platform: iOS 14.5
Device: iPhone 11 Simulator
SyncFusion NuGet: version 16.9.0.54
Xamarin.Forms version: 5.0.0.2012

Edit: I see this thread is regarding WinForms, and my issue is with the Xamarin.Forms package. I hope the issue can still be investigated.


SS Suganya Sethuraman Syncfusion Team May 17, 2021 01:52 PM UTC

Hi Andrew,

We are currently checking the reported issue at our end and we will update the details on May 19, 2021. We appreciate your patience until then.
 
Regards,
Suganya Sethuraman



SS Suganya Sethuraman Syncfusion Team May 19, 2021 01:09 PM UTC

Hi Andrew,

Thanks for your patience.

We have fixed the reported issue and Please download the path from the following location.

Please find the patch setup from below location:

https://syncfusion.com/Installs/support/patch/19.1.0.54/1116113/F165515/SyncfusionPatch_19.1.0.54_1116113_5192021084128029_F165515.exe

(OR)

Please find the patch assemblies alone from below location:

https://syncfusion.com/Installs/support/patch/19.1.0.54/1116113/F165515/SyncfusionPatch_19.1.0.54_1116113_5192021084128029_F165515.zip

(OR)

Please find the NuGet from below location:
   

https://syncfusion.com/Installs/support/patch/19.1.0.54/1116113/F165515/SyncfusionNuget_19.1.0.54_1116113_5192021084128029_F165515.zip

Assembly Version: 19.1.0.54

Disclaimer:

Please note that we have created this patch for version 19.1.0.54 specifically to resolve the following issue reported in this incident. If you have received other patches for the same version for other products, please apply all patches in the order received.

Note: Please clear the cache, before the apply the provided patch

https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache

This fix will be included in our upcoming weekly NuGet release, which will be available on May 25, 2021.

Regards,
Suganya Sethuraman.
 



SS Suganya Sethuraman Syncfusion Team May 25, 2021 11:28 AM UTC

Hi Andrew,

Sorry for the inconvenience.

We could not include this fix in our today weekly. So, we have generated custom NuGet with version 19.1.0.65.

Custom NuGet: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboCustom-936669058

We will include fix in our upcoming weekly NuGet release without delay. Next release will be available on June 1,2021

Regards,
Suganya Sethuraman.
 



SS Suganya Sethuraman Syncfusion Team June 2, 2021 05:08 AM UTC

Hi Andrew,

Thanks for your patience.

We have included the fix in our latest Weekly NuGet release v19.1.0.66 which is available for download (https://www.nuget.org/ ). We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you would require any further assistance.

Regards,
Suganya Sethuraman.
 



JJ Joanna Jimenez Medrano June 15, 2021 06:43 PM UTC

SfComboBox v19.1.0.66, sigue igual no permite SelectIndex = -1, Error. App Android 5, no despliega el control.



SS Suganya Sethuraman Syncfusion Team June 16, 2021 11:25 AM UTC

Hi Joanna,

Greetings from Syncfusion.

We have analyzed your query and checked the reported issue with latest version, but we were unable to reproduce the same. Sample we tried that can be download from below.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboBoxSample651957620

Since we are not aware of your exact application scenario, so we request you to check the issue with the attached sample and let us know whether it is reproduced or not? If the issue was not reproduced in this sample, please revert us by modifying the sample based on your application along with replication procedure or provide the sample. It will help us to provide better solution at the earliest.

Regards,
Suganya Sethuraman. 
 



CC Christian Campos replied to Joanna Jimenez Medrano June 25, 2021 06:44 PM UTC

Intenta usar el método Clear del combobox. Yo le asignaba null al SelectedValue y al SelectedItem pero en algunos casos, no lo asignaba correctamente. Usando el método Clear me funcionó bien, creía que ese método era para eliminar los items del combobox pero no.



SS Suganya Sethuraman Syncfusion Team June 28, 2021 06:29 AM UTC

Hi Joanna,

SfComboBox's clear method is used to clear the SelectedItem or SelectedValue of SfComboBox. This clear method does not clear the ItemsSource of SfComboBox.

Please let us know if you have any other concerns.

Regards,
Suganya Sethuraman.
 



AH Andrew Hoke replied to Suganya Sethuraman September 7, 2021 11:40 PM UTC

Sorry for the late reply. I am now on 19.2.0.60 and still unable to clear the SfComboBox selection by setting the SelectedIndex to -1 via data binding. I have tried changing the binding mode to OneWay and TwoWay and neither work.



SS Suganya Sethuraman Syncfusion Team September 8, 2021 12:14 PM UTC

Hi Andrew,

We have analyzed your query and checked the reported issue with latest version, but we were unable to reproduce the same. Sample we tried that can be download from below.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SfComboBoxDemo-336966512

Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/comboboxdemo-1121597680

Since we are not aware of your exact application scenario, so we request you to check the issue with the attached sample and let us know whether it is reproduced or not? If the issue was not reproduced in this sample, please revert us by modifying the sample based on your application along with replication procedure or provide the sample. It will help us to provide better solution at the earliest.

Regards,
Suganya Sethuraman.  
 


Loader.
Live Chat Icon For mobile
Up arrow icon