This is a migrated thread and some comments may be shown as answers.

Limit the GridviewDecimalColumn text length or maxlength inside a gridview cell

0 Answers 122 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lokesh
Top achievements
Rank 1
Lokesh asked on 12 Mar 2015, 09:47 AM
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?
Julian
Top achievements
Rank 1
commented on 27 Apr 2023, 08:00 AM

Hi,

would still be interested in that issue.

Why is there no MaxLength for GridViewDecimalColumn?

 

Dess | Tech Support Engineer, Principal
Telerik team
commented on 01 May 2023, 11:54 AM

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.

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Lokesh
Top achievements
Rank 1
Share this question
or