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

[Solved] Grid localization doesn't work properly - editing decimals

3 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Art Now
Top achievements
Rank 1
Art Now asked on 02 Feb 2011, 09:55 AM
Try using the link below and edit Unit price if Selected culture is polish or any other language that uses comma as decimal separator

http://demos.telerik.com/aspnet-mvc/razor/grid/localization?culture=pl-PL

Let's take first row with value of 18,00 zl. When I try to edit it by putting 18,20 I get an error "The value '18,2' is not valid for Unit price." On the other hand I cannot put 18.2.

In my own project I have some values like 16,7 in display mode. Going to editing mode changes commas to dot. So I get 16.7 instead of 16,7. Then in controller I cannot update my model as 16.7 is not valid value. If I put 16,7 by hand it works properly. How can I get comma in edit mode? What's more I had to use ".DisplayFormat().DataFormatString("{0:0.00}")" in Fluent Validation for my ViewModel to get commas in display mode it the same as "Format("{0:0.00}");" but in my opinion it should take come from type.

3 Answers, 1 is accepted

Sort by
0
m.wujec
Top achievements
Rank 1
answered on 28 Oct 2011, 08:24 AM
I have in my code the same problem.
0
Georgi Krustev
Telerik team
answered on 28 Oct 2011, 12:31 PM
Hello,

 
Unfortunately, I was not able to observe the depicted issue. Here is a screen-cast, which shows my test.

The issue, which you encounter is more related with ASP.NET MVC. Check this blog post for more information.

The Grid UI component uses jQuery validate framework, which does not validate globalized number. In other words jQuery validate does not know that "18,20" is a valid number. In order to overcome this issue you will need to add your own validate method. 

I hope you will agree with me that the reported issue is not related with the Grid UI component.

Regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
m.wujec
Top achievements
Rank 1
answered on 28 Oct 2011, 02:34 PM
Thank you for quick reaction. But my problem was solved by adding to view:

Html.Telerik().ScriptRegistrar().Globalization(true);


Tags
Grid
Asked by
Art Now
Top achievements
Rank 1
Answers by
m.wujec
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or