Click here to Skip to main content
15,867,878 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In one of my application, I use string.Format("{0:C}",myRate) to display rate with currency symbol. I am getting $ symbol with rate but my client is getting Rs currency symbol instead of $.

Can anyone tell me is this browser issue or my client's machine issue?

I did not faced this kind of issue before. I am totally Surprised!!!

Thanks
Imrankhan
Posted
Updated 30-Dec-10 23:49pm
v3

Hi,

This is because the culture information is different in your machine and your client machine.

you need to specify which culture you want to use otherwise it will use the current one.

using System.Globalization;
...
CultureInfo us = new CultureInfo("en-US");
string text = myRate.ToString("c", us);


Valery.
 
Share this answer
 
v2
Imrankhan,

I not very good at asp.net but i think there are only two posibilties.

1- it could be a browser issue- find out what browser your client is using and try it in the test environment

2- the language settings on the client PC i.e the regional settings of date time and currency
 
Share this answer
 
The client is probably from another country - this should help:
C#
CultureInfo cultureInfo = new CultureInfo("en-US");
string.Format(cultureInfo,"{0:C}",myRate)


By setting in the web config you are changing the defaults:
globalization Element (ASP.NET Settings Schema)
[^]

Your entry 'culture="auto:en-US"' in the web.config specifies what ASP.NET will use if it can't find an HTTP header to determine the user's preferred culture

regards
Espen Harlinn
 
Share this answer
 
v2
Comments
#realJSOP 31-Dec-10 6:13am    
Pay attention. This solution was already posted as an answer.
Espen Harlinn 31-Dec-10 7:00am    
John:
I was only extending my own "answer" by adding comments about globalization and web.config.
Imrankhan:
The following article from MSDN might be of interest
http://msdn.microsoft.com/en-us/magazine/cc163566.aspx
I have already define culture in web.config file as following way.

<globalization culture="auto:en-US" uiCulture="auto:en-US" requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="iso-8859-15"/>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900