May be this is a dumb question, but I cannot find how to make decimal column in grid to display and edit decimal data as it is, i.e
without any trailing zeros and not limiting to DecimalPlaces. For display purposes this may be not so big issue, but column spin editor rounding data to the DecimalPlaces, that is inacceptable at all.
And I still need to limit users on typing only numbers (minus, decimal separator) in the editor, and bind column to a decimal property, i.e. I cannot use plain text column, I think. Could someone suggest a solution?
4 Answers, 1 is accepted
Thank you for writing.
You can use GridViewMaskBoxColumn. For example:
I hope this will be useful. Let me know if you have additional questions.
Telerik by Progress
It was not working for me with "G" (doesn't allow to type decimal separator), but with "N" mask it behaves not as I would expect from the numeric editor. First of all it displays zero mask value for null value, i.e. user sees nothing in the cell, but on editing the value becomes 0.00. Then it looks like the number of decimal places is still limited, because I cannot enter more than 2 digits there. And I cannot enter less than 2 digits as well. Then typing of values are really weird, as soon as I type decimal separator, cursor jumps to the end of the value and next typed digit goes to the last place, i.e. if I type "1", "2", "." and "3", the value will be 12.03, but not 12.30.
So overall this doesn't look like a solution for my issue, it makes things even worse.
That I need is the behavior of the decimal column editor (I mean user experience of typing values there) but without any limitation on decimal places (especially without rounding). May be I may just set a big value for decimal places in the decimal column and then trim trailing zeros on editor initialization, but this will be quite a strange workaround for such a trivial requirement to display and edit decimal values as they are in the grid. Is it really the case that nobody need this feature and it is not supported at all?
Well, in case someone interested, I ended up following the custom editor solution, thanks God Telerik controls has so well structured internal design. Here is the code
It appears that the "G" mask is not behaving as expected (you should be able to enter the decimal separator by default). I have logged this issue in our Feedback Portal and I have added a vote for it on your behalf. You can track its progress, subscribe for status changes and add your comment to it here.
There is no workaround for the masked edit box, and you can use your solution with the spin editor for this.
In addition, thank you for sharing your solution with the community. I am sure that it will be of help for others. This is why I have updated your Telerik Points.
Should you have any other questions do not hesitate to ask.
Telerik by Progress