I have a grid which allows adding new rows via a dropdownlist column.
this column's valuelist is a lookup of objects from db with autonumber ids, so id and text value is shown.
the column in db does not allow nulls.
in the addrow, when trying to add a new row in the grid, when clicking on the dropdown, it defaults to 0.
I'm guessing this is because it is bound to a non nullable datatype and it defaults to 0 since the valuelist values start at 1.
Is there any way to change that? hide it?
Hi,
I'm not sure I understand exactly what's going on, but it sounds like the 0 is coming from the data source and not the grid.
There are a couple of ways you could handle this. One would be to add a null item to your dropdown list with a key value of 0 and an empty string as the text.
Another would be to use a DataFilter to translate the "0" into an empty string (and vice versa) in the EditorToDisplay and DisplayToEditor conversions.
The value list does not contain an item with id 0.
it is bound to an int column.
The 0 appears when row enters edit mode and there's no value selected in the dropdown.
I'll do the datafilter solution, but just so I understand this correctly, does that happen because the column the dropdown is bound to does not allow nulls and 0 is the default value for an int?