Yalda Yalda - 3 months ago 8
ASP.NET (C#) Question

How to show the currency sign after the value in .net?

I'm using Persian culture in my

asp.net
application.

I show prices as

PriceLabel.Text = string.Format("{0:C0}", 12000);


Which results in
12,000 ريال
where
ريال
is the Persian currency sign, but I want the currency sign to come after the value (Persian is left to right, so, by "after", I mean to the left side of the number).

I have tried
Style="text-align: right"
on
PriceLabel
, and
dir="rtl"
on the
<td>
tag containing the label, but that didn't help either.

Answer
var cultureInfo = new CultureInfo("fa-Ir");
cultureInfo.NumberFormat.CurrencyPositivePattern = 3;
cultureInfo.NumberFormat.CurrencyNegativePattern = 3;

var result = string.Format(cultureInfo, "{0:C0}", 12000);

Console.WriteLine(result);
//Result
//12,000 ريال
Comments