Reputation: 290
My data 0.00007173535 is showing as 7.1735351E-05 in aspx page.
My required format is decimal even the number has 20 decimal points. I know its a small thing but couldn't figure it out.
My code is below that is in a repeater.
<%# Math.Round(Convert.ToDouble(Eval("Ranking.Rating")),12)%>
Upvotes: 1
Views: 128
Reputation: 28137
Just call ToString(format)
on it:
0.00007173535.ToString("0.0#################")
outputs
0.00007173535
or
0.00007173535.ToString("N12")
outputs
0.000071735350
See MSDN: Custom Numeric Format Strings for more information.
In your case this would be:
Convert.ToDouble(Eval("Ranking.Rating")).ToString("N12")
Upvotes: 1
Reputation: 98840
Or you can use "F"
format specifier as well.
yourValue.ToString("F20");
Upvotes: 2