How to clear sfComboBox selection such that it displays watermark?

Hi,

Have created an input form that contains text boxes and combo boxes with watermarks along with Submit and Clear button.

The system is displaying watermarks properly when a form is opened. However, it's not displaying a watermark when the user clicks the clear button. [ Clear button resets all controls to blank ].

Steps:

1. Select values from Combobox 
2. click the reset button.
3. System should display the original watermark.

   Private Sub resetMe()

        txtFName.Text = ""
        txtLName.Text = ""
        cboLoc.SelectedIndex = -1
        cboType.SelectedIndex = -1

    End Sub

Language - VB.NET

Refer to Screenshots before and after the Clear button click.





Attachment: combobox_3c316a27.zip

19 Replies 1 reply marked as answer

RA RAAHUL March 10, 2021 07:32 PM UTC

Kindly update...


RA RAAHUL March 11, 2021 12:04 PM UTC

Awaiting for soltion....


VR Vijayalakshmi Roopkumar Syncfusion Team March 11, 2021 12:10 PM UTC

Hi Antonio,  
 
Thank you for your update. 
 
We have checked the reported behavior that clearing the SfComboBox leads to removal of watermark. However we have tried the same at our end, however when you clear using SelectedIndex or set the text of Sfcombobox as null, it will clear the watermark. However we recommend you to clear the item using clear method as shown in following code. 
 
Code:[C#] 
 
 
sfComboBox1.SelectedItems.Clear(); 
 
 
 
 
 
Please go through the video, sample and confirm us whether our understanding on the reported behavior is correct and our suggestion is useful. Else, please modify our sample to issue reproducible, it would be helpful for us to proceed on it further. 
 
Regards, 
Vijayalakshmi VR 



RA RAAHUL March 11, 2021 01:12 PM UTC

Hi Vijayalakshmi,

Have gone through your sample code. Below is my observations.

sfComboBox1.SelectedItems.Clear(); 

  • The above code works only when ComboBoxMode is set to MultiSelection.
  • When ComboBoxMode is set to SingleSelection Combobox is not getting clear.
Refer attached video.....

Attachment: sfComboBox_record_79a3bf1b.rar


RA RAAHUL March 12, 2021 07:56 AM UTC

Hi,

Kindly update on this...

Thanks...


VR Vijayalakshmi Roopkumar Syncfusion Team March 12, 2021 02:50 PM UTC

Hi Rahul  
 
Thank you for your update. 
 
As per architecture of SfComboBox with single selection mode, the watermark get cleared on clearing the text. So to retain watermark, we need to again set this on clearing it, as shown in following code 
 
Code: 
 
 
 
 
sfComboBox1.SelectedIndex = -1; 
// sfComboBox1.SelectedItems.Clear(); 
sfComboBox1.TextBox.Text = sfComboBox1.Watermark; 
sfComboBox1.TextBox.ForeColor = sfComboBox1.Style.EditorStyle.WatermarkForeColor; 
 
 
 
However in our upcoming main volume release 2021, expected to be rolled-out by 29th March, 2021 and we have provide a built-in support to clear the text with property named "ShowClearButton ". It will helps to clear the text and retain the watermark. 
 
We will intimate you once the release get rolled-out. 
 
Regards, 
Vijayalakshmi VR 


Marked as answer

RA RAAHUL March 12, 2021 03:47 PM UTC

Hi Vijayalakshmi,

Thanks for the update. It's working fine as per the solution provided.

Currently, I am using WinForms - Service Pack Release: 18.4.0.39. Will you provide a fix to this version also.

Regards,
Raahul


RA RAAHUL March 12, 2021 09:48 PM UTC

Hi Vijayalakshmi,

Have observed one more issue when the below settings are done.

  1. DropDownStyle = Dropdown
  2. ComboBoxMode = SingleSelection
  3. AutoCompleteMode = SuggestAppend
  4. AutoCompleteSuggestMode = StartsWith
When ComboBox is cleared with the below code then it will select a value that starts with watermark text.

sfComboBox1.SelectedIndex = -1; 
// sfComboBox1.SelectedItems.Clear(); 
sfComboBox1.TextBox.Text = sfComboBox1.Watermark; 
sfComboBox1.TextBox.ForeColor = sfComboBox1.Style.EditorStyle.WatermarkForeColor; 


For Ex:

sfComboBox1.Watermark = "Select Country"

List Values of sfComboBox are as below
  • Australia
  • Brazil
  • Finland
  • Senegal
  • Serbia
  • United States of America
In this case, ComboBox watermark is set to "Senegal" instead of "Select Country".

Kindly look into the same while fixing issues.

Also, let me know if any alternative ways to handle the same.



EM Elakkiya Muthukumarasamy Syncfusion Team March 15, 2021 12:08 PM UTC

Hi Rahul, 
 
Thanks for your update. 
 
We have checked you reported query “ComboBox watermark is set to "Senegal" instead of "Select Country" when set the DropDownStyle as Dropdown “ and we could understood that you are reporting issue when set  
DropDownStyle as Dropdown ,watermark is set as empty. As per current behaviour in SFComboBox when set DropDownStyle as Dropdown, the ComboBox moved to edit mode so the watermark text is removed.Please refer the sample and video for the same. 
 
 
 
 
Please check the above sample and video and confirm our replication procedure is same as yours. If not please modify the sample as issue reproduceable and share Syncfusion product version details. It will be helpful to provide the prompt solution on this. 
 
Regards, 
Elakkiya 



RA RAAHUL March 29, 2021 07:39 PM UTC

Hi,

I am unable to replicate the last comment observation i.e. ComboBox watermark is set to "Senegal" instead of "Select Country" when set the DropDownStyle as Dropdown “.

As per the below comment, expecting a fix for the original observation by 29th Mar 2021.  Kindly update on the same.

Vijayalakshmi Roopkumar [Syncfusion]
Replied On March 12, 2021 02:50 PM UTC

"However in our upcoming main volume release 2021, expected to be rolled-out by 29th March, 2021 and we have provide a built-in support to clear the text with property named "ShowClearButton ". It will helps to clear the text and retain the watermark. 
 
We will intimate you once the release get rolled-out. "




EM Elakkiya Muthukumarasamy Syncfusion Team March 30, 2021 02:14 PM UTC

Hi RAAHUL, 
 
Thanks for your update. 
 
Query: I am unable to replicate the last comment observation i.e. ComboBox watermark is set to "Senegal" instead of "Select Country" when set the DropDownStyle as Dropdown “. 
 
As per current behavior in SFComboBox when setting the DropDownStyle as Dropdown, the ComboBox will be moved to edit mode and, the watermark text is removed. So, please share the replication procedure or issue a video with replication steps or modify the sample as issue reproducible. These details will be helpful for us to provide a prompt solution on this. 
 
 
Query: As per the below comment, expecting a fix for the original observation by 29th Mar 2021 
 
As per our earlier update, we will include the built-in support to clear the text with property named "ShowClearButton" in our upcoming release Vol 1, 2021, which is planned to roll out by end of the day (30th March 2021).We will intimate you once it gets published. We appreciate your patience until then. 
 
Regards, 
Elakkiya 



RA RAAHUL March 30, 2021 03:22 PM UTC

Hi Elakkiya,

Thanks for the update.

Today, have downloaded 19.1.0.54 (Volume 1 2021 - March 30, 2021). However, I am not able to see "ShowClearButton" property in sfComboBox.
Kindly update on the same.

Regards,
Raahul


EM Elakkiya Muthukumarasamy Syncfusion Team March 31, 2021 10:18 AM UTC

Hi RAAHUL, 

Thanks for your update. 

We have checked the reported query with 19.1.0.54 version  and we would like to let you know that built-in support to clear the text with property named "ShowClearButton " has been added in 2021 Volume 1 release and its working fine our side. Please refer the sample and video for the same. 
 
 
 
 
Downloaded link for 2021 Volume 1 release: 
 
 
Please try it with the above solution and let us know if you need any further assistance on this. 

Regards, 
Elakkiya 



RA RAAHUL March 31, 2021 11:27 AM UTC

Hi Elakkiya,

Thanks for the update.

Kindly note this not what I have expected.  As per the reported issue, when ComboBoxMode is set to SingleSelection and the reset command button is pressed then ComboBox selected value will get clear and watermark text will be displayed. [ refer Reply message -  On March 11, 2021 01:12 PM UTC ]..

How this new implementation will help to achieve the above.

Note: Currently, I am using an alternative solution provided by Vijayalakshmi on March 12, 2021.  Have thought the new release will provide a single-line solution instead of 3 line code.

Regards,
Raahul


VR Vijayalakshmi Roopkumar Syncfusion Team April 1, 2021 08:45 AM UTC

Hi Rahul  
 
Sorry for an inconvenience caused. 
 
We could understood that your requirement is to display the watermark after clearing the text. As per behavior of SfComboBox, the watermark would be shown only when control lost it focus. So when you set the DropDownStyle as DropDown for SfComboBox, the control turns to edit mode after clearing the text and it will be in focus. However when you set DropDownStyle is DropDownList, the control does not turns to edit mode and the watermark would be shown. So we suggest you to use the DropDownStyle as DropDownList for SfComboBox.  
 
If you still wants to show the watermark when control is in edit mode, we recommend you to use our solution provided on dated March, 12, 2021. 
 
Please let us know if you have any other concerns on this. 
 
Regards, 
Vijayalakshmi VR 



RA RAAHUL April 1, 2021 10:01 AM UTC

Dear Vijayalakshmi,

Even if DropDownStyle is set as DropDownList, the watermark is not displayed after resetting Combobox. Watermark is displaying only when the user reselects Combobox manually and changes the focus to another control.

Refer attached video for your reference.

Have tried the below code. However, none of them worked.

  • sfComboBox1.SelectedIndex = -1;
  • sfComboBox1.SelectedItems.Clear();
  • sfComboBox1.TextBox.Text = "";
  • sfComboBox1.Text = "";

Regards,
Raahul 

Attachment: sfComboBox_Watermark_issue_99501a85.rar


VR Vijayalakshmi Roopkumar Syncfusion Team April 2, 2021 11:24 AM UTC

Hi Rahul 
 
Thank you for your update. 
 
Yes, we could able to observe the watermark text is not displayed on clearing the text manually with DropDownStyle as DropDownList and we have confirmed it is a defect. We have logged a defect report on this and the patch for this fix is estimated to be available on 23rd April,2021. 
 
We will share the feedback link shortly. 
 
Please let us know if you have any other concerns on this. 
 
Regards 
Vijayalakshmi VR 



VR Vijayalakshmi Roopkumar Syncfusion Team April 5, 2021 09:57 AM UTC

Hi Rahul

Please find the feedback link for the reported behavior "watermark text is not displayed on clearing the text manually with DropDownStyle as DropDownList" with SfComboBox in the below link:

Link: https://www.syncfusion.com/feedback/23965/watermark-text-is-not-displayed-in-sfcombobox-on-clearing-the-text-at-runtime-with 

The patch for this fix is estimated to be available on 23rd April, 2021.

Regards,
Vijayalakshmi VR 



VR Vijayalakshmi Roopkumar Syncfusion Team April 23, 2021 02:02 PM UTC

Hi Rahul,   
  
Thanks for your patience.  
  
The reported issue with SfComboBoxwatermark text is not displayed on clearing the text manually with DropDownStyle as DropDownLis has been fixed and included in the patch which can be download from the below links.  
 
Recommended approach - exe will perform automatic configuration.   
Please find the patch setup from below location:  
Please find the patch assemblies alone from below location:   
  
  
Assembly Version: 19.1.0.54 
   
Installation Directions:   
This patch should replace the files “Syncfusion.SfListView.Winforms” under the following folder.   
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\[TargetFramework]   
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\19.1.0.54\precompiledassemblies\19.1.0.54\4.6   
   
To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you must manually copy and paste them to the preferred location or you must run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.   
   
 
   
Disclaimer:   
Please note that we have created this patch for version 19.1.0.54 specifically to resolve the 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.  Please let us know, if you are using any other Syncfusion version, we will provide patch in your version.   
   
Regards,   
Vijayalakshmi VR  
 


Loader.
Up arrow icon