Answered by:
Set currency symbol to euro's

Question
-
User637998132 posted
Hi
I’m converting an integer to currency but always want to display the euro symbol, no matter where they are.
also i don't want to change the culture from UK
Now it works but then sometimes it does not display the euro symbol but a # like symbol.
http://langdon.syndicut.com/Property-Search.aspx
if you click read more or use the filters a few times you should be able to see the issue
NumberFormatInfo nfi = new NumberFormatInfo(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SetupPage(); } nfi.CurrencyDecimalDigits = 0; nfi.CurrencySymbol = "€"; } /* this below bit is called in a method if (CMSContext.CurrentDocument.GetValue("property_price_max") == null) { LtrPrice.Text = "Priced " + String.Format(nfi,"{0:c}", decimal.Parse(CMSContext.CurrentDocument.GetValue("property_price_min").ToString())); } else { LtrPrice.Text = "Priced from " + String.Format(nfi,"{0:c}", decimal.Parse(CMSContext.CurrentDocument.GetValue("property_price_min").ToString())) + "-" + String.Format(nfi,"{0:c}", decimal.Parse(CMSContext.CurrentDocument.GetValue("property_price_max").ToString())); }
i'm using the kentico cms so thats what CMSContext.CurrentDocument.GetValue is, everyting else is just asp.net c#
Thanks
CMSContext.CurrentDocument.GetValue
Thursday, May 13, 2010 5:12 AM
Answers
-
User-1636183269 posted
In this case you don't need to require to create base page, then every page have initializeculture then you can implement on same page.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, May 13, 2010 12:41 PM
All replies
-
User-1636183269 posted
you can change at your level as I have mention in this forum, please go through http://forums.asp.net/p/1514920/3621670.aspx
Similar you have to do.
Protected Overloads Overrides Sub InitializeCulture()
Dim objCultureInfo As New CultureInfo("el-GR")
Thread.CurrentThread.CurrentUICulture = objCultureInfoDim objDateTimeFormatInfo As DateTimeFormatInfo = objCultureInfo.DateTimeFormat
objDateTimeFormatInfo.ShortDatePattern = "dd/MM/yy"
objDateTimeFormatInfo.LongDatePattern = "dd/MM/yyyy"
objCultureInfo.DateTimeFormat = objDateTimeFormatInfo
objCultureInfo.NumberFormat.NumberGroupSeparator = "."
objCultureInfo.NumberFormat.NumberDecimalSeparator = ","
objCultureInfo.NumberFormat.NumberGroupSeparator = "."
objCultureInfo.NumberFormat.CurrencyDecimalSeparator = ","
objCultureInfo.NumberFormat.CurrencyGroupSeparator = "."
objCultureInfo.NumberFormat.CurrencySymbol = "€"
Thread.CurrentThread.CurrentCulture = objCultureInfo
objDateTimeFormatInfo = Nothing
objCultureInfo = Nothing
MyBase.InitializeCulture()
End SubThursday, May 13, 2010 7:22 AM -
User637998132 posted
cool
not tried this yet but won't this affect the whole site?
i only want to set it on the one page
Thursday, May 13, 2010 7:42 AM -
User-1636183269 posted
In this case you don't need to require to create base page, then every page have initializeculture then you can implement on same page.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, May 13, 2010 12:41 PM