I have a web site with different languages. Inside a model, I have the following member declaration:
[Required(ErrorMessageResourceType = typeof(ViewRes.GlobalResource), ErrorMessageResourceName = "awr1")]
[Range(typeof(decimal), "0.00100001", "10000", ErrorMessageResourceType = typeof(ViewRes.GlobalResource), ErrorMessageResourceName = "TotalMoneyMinMaxValidation")]
public decimal TotalMoney { get; set; }
When I change the UI culture to ru-RU
, I get the following error:
0.00100001 is not a valid value for Decimal.
How can I keep my culture info and UI as ru-RU
but have all decimals be a period(.) instead of a comma(,)?
Here's what I've tried:
CultureInfo ci = new CultureInfo("ru-RU");
ci.NumberFormat.NumberDecimalSeparator = ".";
Thread.CurrentThread.CurrentUICulture = ci;
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ci.Name);
not working...