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
close icon

How to select null value with UI in a dropdownlist

Hi!

I use dropdownlist as the edit type in a grid column to fill a nullable foreign key field
I fill data with a query to a database and I have multiples elements in the drop down.
I can choose anyone and save.

But how can I remove the selected value after to set the foreign key value to null ?
I dont' find it in the documentation.

Best regards,

Benoit

3 Replies

RS Renjith Singh Rajendran Syncfusion Team September 9, 2019 12:43 PM UTC

Hi Benoit, 

Thanks for contacting Syncfusion support. 

We are not clear about your requirement. We suspect that, you need to set the empty value for corresponding column whenever you want, through a dropdownlist.  

If so, then we suggest you to have a null value in your data source for that corresponding column. So while rendering the dropdown control the null value is shown as empty in the dropdownlist, you can select the empty item from the dropdownlist.  

For your convenience we have prepared a sample based on this scenario. Please download the sample from the link below, 

If we have misunderstood your query, then we need more details to further proceed on this and provide you a solution as early as possible. Share with us the following details from better assistance. 
  1. Share a detailed explanation of your query or the problem you are facing.
  2. Share a video demo explaining your complete requirement.
  3. If possible, share the sample which you have tried from your side.

The provided information will help us analyze the requirement, and provide you a solution as early as possible. 

Regards, 
Renjith Singh Rajendran. 



BE Benoit September 10, 2019 12:01 AM UTC

Hi Renjith,

Thanks for your response. You understood my query correctly.

I don't really like this solution because I have to manage an empty object. My ForeignKeyField property is a primary key of my "foreign" object, so I cannot set it to NULL. I have to create a DTO object to populate dropdownlist.

I used other controls from other component suppliers in the past and they had an option to set the dropdown value to null. For example, hit Backspace on the editor.

Anyway, thanks for your answer.

Benoit


RS Renjith Singh Rajendran Syncfusion Team September 11, 2019 10:24 AM UTC

Hi Benoit, 
  
Thanks for your update. 
  
We have analyzed your requirement. As dropdownlist is a read only control, we suggest you to have a “ComboBox” during edit by using the “Cell Edit Template” feature to achieve this requirement. Now you can have null values when you hit backspace in ComboBox’s editor. 
  
But currently we are facing issue when using “cell edit template feature” in foreign key column. We have confirmed this as a defect and logged a defect report for the same. Thank you for taking the time to report this issue “Problem in updating values to foreign key column using cell edit template” and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our subsequent Nuget release which is expected to be roll out in the end of September.  
  
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.  
  
Once the release is rolled out we will provide a sample based on your requirement. Until then we appreciate your patience. 
  
Regards, 
Renjith Singh Rajendran. 


Loader.
Live Chat Icon For mobile
Up arrow icon