Format Currency Sign on Charts, Grids and Pages
It is often then you develop a web page in ASP.NET and you are required to show custom culture information. But often the data has only one(same) currency(for example Swedish Krona). A nice and easy solution is to use Thread.CurrentThread.CurrentCulture property. Here is a sample of code. The advantage is that you can have it in one place and the whole application will use it. //Try to get user's browser predefined language, if fails go to English as default language var userLanguage = Request.UserLanguages.FirstOrDefault() ?? "en"; var userCulture = CultureInfo.CreateSpecificCulture(userLanguage); //Set number format for userCulture to swedish(override current user culture) //So we can have kr as a currency sign. NumberFormatInfo nfiSwedish = new CultureInfo("sv-SE", false).NumberFormat; userCulture.NumberFormat.CurrencySymbol = nfiSwedish.CurrencySymbol + " "; Thread.Curre...