Click here to Skip to main content
15,889,858 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
public CultureInfo ci = (CultureInfo)CultureInfo.InvariantCulture.Clone()

            ci.NumberFormat.NumberDecimalSeparator = ",";
            ci.NumberFormat.NumberGroupSeparator = ".";


I am using language culture system for my application and my application working fine in all aspects but i get one bug realted to decimal numbers which is binded in datalist then get change in comma instead of decimail where i have implemented math.round .
<%#Convert.ToString(Math.Round(Convert.ToDouble(Eval("conct_level2").ToString(),CultureInfo.InvariantCulture.NumberFormat), 1, MidpointRounding.AwayFromZero))%>


output:1,3

<%#Eval("deltacpm")%>

output:2.0
how can i slove this isue please help me its urgent
Posted
Updated 30-Apr-12 23:32pm
v2

The problem is that your Convert.ToString is not using invariant culture - so it will use the current culture. Your ToDouble does use invariant culture - but the final conversion to a string doesn't!
 
Share this answer
 
Set CurrentCulture, CurrentUICulture, and OverrideMetadata early in your application. See my tip WPF: Binding non-textual content to textboxes in the correct localization[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900