<%= Math.Round(netValue)%>
One example of it's output could be -1243313
How do I make sure it's formatted as US currency (with the '$', correct commas, etc.)?
Maybe:
<%=string.Format(CultureInfo.GetCultureInfo(1033), "{0:C}", Math.Round(netValue)) %>
(1033 is the locale id for the 'en-us' culture)
If the thread culture happens to already be en-US, then you don't need to specify it.
<%= Math.Round(netValue).ToString("C") %>
Otherwise, to get the culture for the United States, first create a culture object.
CultureInfo usaCulture = new CultureInfo("en-US");
You can then pass that to the ToString method on the decimal object.
<%= Math.Round(netValue).ToString("C", usaCulture) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With