locked
How to change CurrencyGroupSeparator for a language RRS feed

  • Question

  • User1839264530 posted

    How is it possible to change the CurrencyGroupSeparator for a special language? It would be nice if i could change it once and the it will work on the entire site :-)

     

    Thanks in advance!

    Tuesday, January 19, 2010 8:18 AM

All replies

  • User641418711 posted

    Halo pnr,

    What you looking for is globalization.

    Take a look at this link http://msdn.microsoft.com/en-us/library/bz9tc508%28VS.80%29.aspx


    Happy coding.


    Tuesday, January 19, 2010 8:40 PM
  • User1839264530 posted

    Thanks for your reply!

    I am already using Globalization, but my problem is that i want too change the  default CurrencyGroupSeparato for a special language.

    I have tried this:

     Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(Language);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Language);
    
            if(Language == "ru-RU")
            {
                Thread.CurrentThread.CurrentUICulture.NumberFormat.CurrencyGroupSeparator = ".";
                Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyGroupSeparator = ".";            
            }
    But i get a runtime error "Instance is read-only"


     

     

    Wednesday, January 20, 2010 1:58 AM
  • User1577733570 posted

     Hi,

    Try this.

    NumberFormatInfo nfi = new CultureInfo( "ru-RU", true ).NumberFormat;

    nfi.CurrencyGroupSeparator = ".";


     

     

    Wednesday, January 20, 2010 2:19 AM
  • User1839264530 posted

    Thanks for your reply!

    In my masterpage i am setting the CultureInfo to the chosen language, the same place i want to change the CurrencyGroupSeparator for the Russian language. So it wil work on all the childpages to the masterpage.

    Your example isn't changing the GroupSepeartor in the way i have explained abow.

    Wednesday, January 20, 2010 5:00 AM