Last post Feb 25, 2019 12:01 PM by PatriceSc
Feb 25, 2019 10:06 AM|brucey|LINK
Hi everyone, looking for some help with formatting, I'm trying to output price in en-GB, but receiving the following error;
Returns the text representation of the value of the current Nullable<T> object.
No overload for method ToString takes 2 arguments
£(@t.ProductUnitSalePrice.ToString("C", new CultureInfo("en-GB"))
Any pointers much appreciated.
Feb 25, 2019 11:03 AM|yogyogi|LINK
Try the below code:
Feb 25, 2019 11:18 AM|brucey|LINK
Sorry, still receiving the same error
Feb 25, 2019 11:58 AM|yogyogi|LINK
It will automatically show you $ or £ value based on the setting of the culture in your browser.
Feb 25, 2019 12:01 PM|PatriceSc|LINK
You are using https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1.tostring?view=netframework-4.7.2
which doesn't accept parameters.
What do you want to do if the value is null ? You could use data annorations.
en-GB is not the default culture for your web site? You could consider using https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.displayformatattribute?view=netframework-4.7.2