Reputation: 1541
I am developing a MVC app. I have some amount fields. by default it showing numbers without comma separation. for e.g. if I have amount 500000000 then I want to display it like 50,00,00,000 I want to show in Indian currency format,in indian format first comma comes after 3 digits then for every 2 digits comma appears.
How to do this ?
I have tried this , but giving an error...
@{
long myNumber = 123981202803;
System.Globalization.CultureInfo Indian = new System.Globalization.CultureInfo("hi-IN");
}
@(String.Format(Indian, "{0:N}", modelItem => item.SanctionedAmount))
}
Upvotes: 0
Views: 2989
Reputation: 7944
Try
CultureInfo Indian = new CultureInfo("in-IN");
String.Format(Indian,"{0:N}", myNumber);
In the view add something like: (list of culutres i.e "hi-IN" here)
<h3>
@{
long myNumber = 123981202803;
System.Globalization.CultureInfo Indian = new System.Globalization.CultureInfo("hi-IN");
}
@(String.Format(Indian, "{0:N}", myNumber))
</h3>
Prodcues
1,23,98,12,02,803.00
Upvotes: 1
Reputation: 39258
You have to set the appropriate culture for each region you want specific formatting for. Take a look at this: http://msdn.microsoft.com/en-us/library/syy068tk(v=vs.71).aspx
Upvotes: 1