String.Format {0:C} works for UK pounds and not US dollars

Posted on 2007-07-20
Medium Priority
Last Modified: 2008-02-20

I'm developing and asp.net application using c#.
I need to display a currency value on screen.

double OrderCost = 10.99;
string sOrderCost = String.Format("{0:C}", OrderCost);

This line works fine and displays the value as £10.99 (I'm developing it in the UK)
However if I change my regional settings to English (United States) and run the application
the value is displayed on screen in pounds and not dollars.

Can the string.format function handle this or do I need to implement more code??

Please help, Ruairi.

Question by:CoreSupport
LVL 12

Expert Comment

ID: 19532591
are you changing the regional settings on the server or on the client machine?
LVL 29

Accepted Solution

David H.H.Lee earned 2000 total points
ID: 19533751
Dear CoreSupport,
You can override the regional setting in web.config.
  <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-GB">

You can check more details regarding culture settings here:

Complete culture list to apply:

Author Comment

ID: 19545879
Hi craskin, I was changing the regional settings on the server and running the applicaiton on the server.

x com, that worked. Thanks!

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question