?
Solved

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

Posted on 2007-07-20
3
Medium Priority
?
2,054 Views
Last Modified: 2008-02-20
Hi,

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.

0
Comment
Question by:CoreSupport
3 Comments
 
LVL 12

Expert Comment

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

Accepted Solution

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

You can check more details regarding culture settings here:
http://www.c-sharpcorner.com/UploadFile/Santhi.M/GlobalizationusingASP.NET11262005072116AM/GlobalizationusingASP.NET.aspx

Complete culture list to apply:
http://asp.infoz.hk/App/CultureList.aspx
0
 

Author Comment

by:CoreSupport
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!
0

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