Reputation: 778
Can I format a telephone number as per current culture? For example, to format price as per culture, I use this:
public object Convert(object value, Type targetType, object para, System.Globalization.CultureInfo culture)
{
string currency = value.ToString();
if (!string.IsNullOrEmpty(currency) && !string.IsNullOrWhiteSpace(currency))
{
Int64 C;
bool result = Int64.TryParse(currency, out C);
if (result)
{
currency = "Price: " + C.ToString("C", culture);
}
}
return currency;
}
This will show my price depending on culture (For es-ES culture -> Price: $5 if value = 5). Is there a way to do something similar for a telephone number?
Upvotes: 1
Views: 986
Reputation: 192
I don't believe there is a built-in way to display localized phone numbers, but a very similar question on Stack Overflow provided a solution concept that should work for you. See here: Display Phone Number In Different Country format in asp.net. using locale
Upvotes: 1