I have a column for decimal field values. I have set its format to #.#. So nothing shows when it a cell value is 0. This works great until one clear out all contents from the cell using Delete and tabs out of cell. That's when he gets the "value in editor is invalid" error message from Grid.
I am guessing there is some setting that would interpret a completely emptied out cell to mean "0". That way the system is happy with the numeric value and does not return the error.
Let me know the best way to to get around this problem.
Thanks!
yes, this is good.
Well, if your data source does not allow nulls, then what are you expecting to happen when the cell is cleared?
Hi Mike,
I have tried it is not the problem of "n" and "#". If the DataColumn of the dataset allows DBNull, it will OK. When it doesn't allow DBNull, whatever you set the mask, you will get an error when clear everything in the cell and exit edit.
Again... if I use "n", instead of "#", this works fine for me. "#" is a required characters, so if you use that in your mask, you cannot leave it blank. "n" indicates a number section which can be left blank.
As I said above, if you are using "n", and it's not working, then something else is wrong there. It might be a bug in an old version of the controls (although this seems very unlikely). But it's definitely working for me in v9.2. So if this doesn't work, then either your application is not actually using the "n" (perhaps it's being overwritten by something else your code is doing) or it's a bug in the version you are using.
Mike,
There is still a confusion about the problem statement.
Mike Saltzman said:I don't think there's any way to stop the 0.0 from displaying once the cell goes into edit mode. 0 is, in fact, the value of the cell, so I don't see any way around that.
In fact, I am okay with 0.0 showing when cell goes into edit mode. That is not a problem at all. Let me explain this way
If you review my previous post, you will see from my picture, the problem is when one tabs out of the cell (in edit mode) after completely clearing it out using delete.
We do not want the tab out to report this error I mentioned. And we want the underlying DataColumn to get a 0 value even though the cell was completely cleared out.