Hi,
I using xamDatGrid , While editing certain entry if i delete contents in string value type field , it throws bellow exception.
Object of type 'System.DBNull' cannot be converted to type 'System.String'.
As i am doing my validation separately on my DataContract level, Could you please suggest any solution to suppress this error and proceed with default values of field.
Please its urgent.
Hello,
Every cell in the grid consists of a xamEditor which holds the value of the cell. If some validation is to be done or removed it should be performed within this xamEditor. The grid itself does not have a property which turns on and off validation as many users ask.
About this problem, why don't you try to handler this exception in the EditModeEnding event and check if the new/edited value is DBNull and return a proper string.
Hope this helps.
I'm not sure I understand why the edited value would be DBNull instead of simply empty string or null.
If the grid is bound to a collection of objects- null is a valid value for string, so why can it not assign null?
I get the solution and I guess thats what I'm going to be doing, but this feels pretty clunky.