Setting Currency Format

Last post 01-07-2007 1:42 PM by adammillsy. 3 replies.

Sort Posts:

  • Setting Currency Format

    01-07-2007, 8:57 AM
    • Loading...
    • adammillsy
    • Joined on 09-07-2006, 7:02 AM
    • Posts 89

    Hi

    I am trying to format the currency when I am displaying product information.

    I am currently using (in c#):

    productprice.text= String.Format("{0:C}", 0);

    Which is displaying in dollars($) however I want to display my currency in pounds(£) but I have been unable to find any examples of how this is done?
     

  • Re: Setting Currency Format

    01-07-2007, 9:36 AM
    Answer
    • Loading...
    • vivek_iit
    • Joined on 06-18-2006, 2:13 PM
    • New Delhi
    • Posts 3,072
    • TrustedFriends-MVPs

    Hi,

    You need to set the Culture property of the current thread, as shown in this article:

    http://www.codeproject.com/useritems/localization.asp

    HTH,

    Vivek

    MVP, ASP.NET || My Website || Blog || Articles

    Please mark the most helpful reply/replies as "Answer".
  • Re: Setting Currency Format

    01-07-2007, 12:05 PM
    Answer
    • Loading...
    • Jigar
    • Joined on 06-17-2002, 9:41 AM
    • Ridgewood, NJ
    • Posts 935

    1) If you want to change currency format globally then use Web.config settings 

    <configuration>  
        <system.web>  
            <globalization culture="en-US" uiCulture="en-GB" />  
        </system.web> 
    </configuration>
    
      

    2) For page levent Page level settings 

    <%@Page Culture="en-US" UICulture="en-GB" %>
    

    3) If you want to display  £ just on current place and want to keep existing global settings for culture then

    string.Format( System.Globalization.CultureInfo.GetCultureInfo("en-GB").NumberFormat,
          "{0:c}", 12.012);
     or 
    string.Format("{0:£0,0.00}", 12.012)
     
    Jigar Desai
    -----------------------
    Do not forget to "Mark as Answer" on the post that helped you.
  • Re: Setting Currency Format

    01-07-2007, 1:42 PM
    • Loading...
    • adammillsy
    • Joined on 09-07-2006, 7:02 AM
    • Posts 89

    Sound as a pound!

    Cheers guys, I now have my page displaying in £, and have a decent understanding of how globalization works. 

    Big Smile 

Page 1 of 1 (4 items)
Microsoft Communities
Page view counter