0

I have been looking around here and I have found this solution:

ViewBag.lon = double.Parse(parts[1], CultureInfo.InvariantCulture);

this is doing the trick... partially... When I put this value in my ViewBag and write it out, the '.' becomes a ',' suddenly... who can I fix this?

Seems like everything is going fine untill getting it out of the ViewBag... in the ViewBag they're all ok..

any solutions?

user1122844
  • 87
  • 4
  • 13

1 Answers1

0

What's probably happening is that your default culture uses a comma as decimal point (e.g. Spain). One way to force it, is to write it out providing a format string:

@(ViewBag.lon.ToString("#,##0.00"))

See: http://msdn.microsoft.com/en-us/library/0c899ak8.aspx

Diego
  • 18,035
  • 5
  • 62
  • 66