I have a form databound to a customer object, and one of the fields is a nullable int representing a “type”. This is displayed as a combobox, and the combobox is bound to the “Types” table.
When a customer with a null type is loaded into the form’s datasource, the combo box displays no value, but then upon clicking it you must select a value. The form/combobox will never let you change back to a blank item (to represent “null” on the customer object).
I don’t want “dummy rows” in the database, and currently do this by adding a dummy object, and nulling it out in a submit event (not clean!).
Is it possible to do this cleanly, keeping with the nullable primary key?
The datasource which is used to bind to the Type combo, could have 1 more entry with NULL value in it.
You could store -1 for Customer who doesn’t have a type (if it is allowed that a customer need not have a type).