I Need to display a number with commas and decimal point.
Eg: Case 1 : Decimal number is 432324 (This does not have commas or decimal Points) Need to display it
CultureInfo us = new CultureInfo("en-US");
TotalAmount.ToString("N", us)
int number = 1234567890;
Convert.ToDecimal(number).ToString("#,##0.00");
You will get the result 1,234,567,890.00
.
For Razor View:
$@string.Format("{0:#,0.00}",item.TotalAmount)
string Mynewcurrency = DisplayIndianCurrency("7743450.00");
private string DisplayIndianCurrency(string EXruppesformate)
{
string fare = EXruppesformate;
decimal parsed = decimal.Parse(fare, CultureInfo.InvariantCulture);
CultureInfo hindi = new CultureInfo("en-IN");
// string text = string.Format(hindi, "{0:c}", parsed);if you want <b>Rs 77,43,450.00</b>
string text = string.Format(hindi, "{0:N}", parsed); //if you want <b>77,43,450.00</b>
return ruppesformate = text;
}
Your question is not very clear but this should achieve what you are trying to do:
decimal numericValue = 3494309432324.00m;
string formatted = numericValue.ToString("#,##0.00");
Then formatted
will contain: 3,494,309,432,324.00
All that is needed is "#,0.00", c# does the rest.
Num.ToString("#,0.00"")