Search code examples
c#asp.netstring-formattingcurrencyculture

ASP.Net: Setting the correct currency settings for string.Format()


In my ASP.Net Website I am using

String.Format("{0:C}", param)  

to format currency values. On my local machine this works great, but when deploying the website to the server the output switches from € to $.

Obviously the server has different Culture settings, is there an easy way to change this application wide? (without direct access to the servers settings)

Is there an web.config entry I can change?


Solution

  • You can do this in web.config

    http://msdn.microsoft.com/en-us/library/bz9tc508.aspx

    In an ASP.NET Web page, you can set to two culture values, the Culture and UICulture properties. The Culture value determines the results of culture-dependent functions, such as the date, number, and currency formatting, and so on. The UICulture value determines which resources are loaded for the page.

    Example

    <globalization uiCulture="es" culture="es-MX" />