Out of the box I have a simple sql server table with a field IsEnabled of type bit, default of 1 non null. I build the app and at runtime when the AddPage is shown I cant toggle the IsEnabled checkbox on the form.
When I edit the page the checkbox is ticked (as the field had a default of 1) but I cant then untick it.
The control is a checkbox with tristate ticked.
If I then untick tristate for the checkbox , rebuild and run again the edit works correctly but the add page still does not
Am I missing something?
Tri-state CheckBox can be used for nullable database fields
What I was really saying is that the Checkbox does not toggle on form pages when its tristate. You click it nothing happens. If you deselect tristate it will then allow you to toggle it on edit pages but not the add page.Strange. Tries it on both Edge and Chrome
When you tick a ChecBox the component will attempt to set the value according to the specified value type. If the type is not nullable and TriState is set to true the CheckBox will unable to work correctly since it will be impossible to set null.
Maybe when the page is scaffolded if the field is checkbox and nullable set the Tristate to true else leave it false by default.
Either way when its an Add page and the checkbox is not trisate it saves the default into the db and wont let you toggle it so you have to then edit the form after saving the Add and toggle it off there.