Reputation: 37
I use telerik report in my application .I set culture 'fa-IR'. in my data source when the property is decimal it shows number in Persian mode but if property are string it shows number in English I can't changed the property type because it have anther char
I want all numeric Character in Persian mode what can i do?
Upvotes: 0
Views: 84
Reputation: 427
If your property is string, you just need to replace numbers with persian numbers equivalent using a simple method. Here is a simple extension method that you can use.
public string ToPersianNumber(this string s)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("0", "٠");
dictionary.Add("1", "١");
dictionary.Add("2", "٢");
dictionary.Add("3", "٣");
dictionary.Add("4", "٤");
dictionary.Add("5", "٥");
dictionary.Add("6", "٦");
dictionary.Add("7", "٧");
dictionary.Add("8", "٨");
dictionary.Add("9", "٩");
dictionary.Aggregate(s, (current, value) => current.Replace(value.Key, value.Value)).ToString();
}
then use it on your property.
yourObject.yourProperty.ToPersianNumber();
Upvotes: 1