How to set DropDownDataGrid and Datepicker to null based on a bool value

Hello,

As the topic suggests I'm trying to set the value of some dropdowndatagrids and datepicker fields to null when a bool value is false. I have checkboxes which makes certain panels visible if checked, my problem is that if these panels are made invisible (checkboxes set to false) the values in the invisible panels still remain. For textboxes I have managed to fix the issue with the following expression in the value property:
${table.column1 ? table.column2 : null}.
This does not work for datepicker or dropdowndatagrid however. If there's a smooth way to solve this in Radzen I would be really grateful :slight_smile:

Thanks in advance!
/Rikard

Hi @RIProG ,

You can assign a Page property for Value and set this page property to null when the CheckBox value is changed (Change event).

Thanks for the response @enchev, I'll look in to it. I need the Value-property for saving to db when the panel is visible.

Another question @enchev:
The panels I mentioned above which become visible when a checkbox is clicked contain both textboxes and dropdowndatagrids with validation. The validation for the dropdowns seem to work fine, but the validation for the textboxes doesn't. Do you have any idea why, and if there is an easy way to fix it?

Update: I noticed that the reason the validation for these textboxes didn't work was because I had a condition in their value property. When using the syntax ${table.column1 ? table.column2 : null} the validation doesn't trigger, so I changed it to ${table.column2} (the difference being that in the first case it doesn't bind the value @bind-Value, it just sets a Value). Now I just hope our customer won't be frequent in making the panel visible multiple times in a single form and entering values that aren't supposed to be saved :stuck_out_tongue: