Hello,
I am using a radgridview in which I am adding a gridviewdecimalcolumn, but I want to restrict the user from entering the specific number of decimals.
Eg: If I am having a column and I enter the value for it '123456789' then it gets entered while if i want to restrict the user to enter the value only upto 3 places i.e 123 it isn't possible as in if I am giving the maximum then it changes to 999 but I don't want it like that I want that if the user enters the value as '333' then it should get entered only upto that number of decimal places after that if the user enters any number it should not get displayed or entered.So how to do this?
I am using a radgridview in which I am adding a gridviewdecimalcolumn, but I want to restrict the user from entering the specific number of decimals.
Eg: If I am having a column and I enter the value for it '123456789' then it gets entered while if i want to restrict the user to enter the value only upto 3 places i.e 123 it isn't possible as in if I am giving the maximum then it changes to 999 but I don't want it like that I want that if the user enters the value as '333' then it should get entered only upto that number of decimal places after that if the user enters any number it should not get displayed or entered.So how to do this?
Hi,
would still be interested in that issue.
Why is there no MaxLength for GridViewDecimalColumn?
Hi, Julian,
By default, the MaxLength property is available for the GridViewTextBoxColumn since it is applicable for string values. If you want to provide any restrictions to the entered values, it is good to consider using a GridViewMaskBoxColumn with MaskType.Numeric. An alternative approach is to validate the editor's input in the grid cell before committing the value to the grid. The CellValidating event is an appropriate place to perform such validation logic.
I hope this information helps. In case you are still experiencing any further difficulties it would be greatly appreciated if you can provide more details about the exact goal that you are trying to achieve. Thus, we would get better understanding of the precise case and provide further assistance.