I am developing an ASP.NET MVC 3 application that uses jQuery globalization and jQuery UI Slider .
I localize this application for Portuguese from Brazil (pt-BR) and also supports English.
The problem is that when I change the language to Portuguese, all Model values floatare separated by a comma (,), like 7.7. Then I try to set the initial value of Slider, but it only accepts a value with a period (.), For example 7.7.
To overcome this situation, I do this:
$.CreateSlider("#sliderHeight", "#Height", @Model.Height.FormatValue(), 0, 2.5, 0.01);
FormatValue is an extension method:
public static string FormatValue(this float value)
{
return value.Value.ToString().Replace(",", ".");
}
You see, I need to replace the comma delimiter with a dot delimiter so that I can set the value of the jQuery slider.
jQuery-, :
$(textBox).val($.global.format(ui.value, 'n2'));
...
:
?
, , , .. pt-BR, (,). , . , jQuery Slider .
: , @Model, - , , , ( ):
$.CreateSlider("#sliderHeight", "#Height", 7,7 , 0, 2.5, 0.01);