Last post Oct 21, 2010 07:39 PM by energie design
Mar 16, 2010 10:49 PM|ancross|LINK
I'm using "," as separator for decimal in my app ( price: for example 12,34 ).
Everything was fine until I switch from my local machine to server.
Then I found out, that my prices are shifted left by 2digits ( should be 12,34 but there is 1234,00 ).
I guess that problem is with separator in "Regional and Languages Options".
What can I do with this ?
Thanks in advance
Mar 17, 2010 12:38 AM|Cheezy|LINK
you can override the current settings by replacing the culture of the current request. just to give you idea :
Globalization.CultureInfo culture = new Globalization.CultureInfo("en-US", false);
culture.NumberFormat.CurrencyDecimalDigits = 2;
culture.NumberFormat.CurrencyDecimalSeparator = ",";
Threading.Thread.CurrentThread.CurrentCulture = culture;
after this, all your calls to currency will follow what you have specified on the culture.
Oct 21, 2010 07:39 PM|Energie Design|LINK
I got this problem:
SQL Database is on en-US WEB server
The web Site is force for fr-FR Culture Info
When I display value I got 1234,75
Using the FormView EditMode and saving the value it will be changed to 123475
Therefore the data totally out of wack. Specially since the user will put the decimal "," all the time because that the way he knows it.
Please help if you can.
-------- Code -------
'The field type in SQL Database is Float for CostPrice, SalePrice, DiscountPrice
<asp:Parameter Name="DocUNID" Type="Object" />
<asp:Parameter Name="CostPrice" Type="Double" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="SalePrice" Type="Double" ConvertEmptyStringToNull="true" />
<asp:Parameter Name="DiscountPrice" Type="Double" ConvertEmptyStringToNull="true" />