0

I have razor code like this :

@Html.DisplayFor(model => item.sepordan_melk_foroshes.ghamat_total)

as a resault it display this :

123.00

how can i remove the last part and show it like this? :

123

I would be so grateful if anyone help me.

Kevin Kunderman
  • 2,036
  • 1
  • 19
  • 30
Ramin
  • 473
  • 1
  • 5
  • 15
  • possible duplicate of [Html.DisplayFor decimal format?](http://stackoverflow.com/questions/12067375/html-displayfor-decimal-format) – Kevin Kunderman Sep 11 '13 at 13:52

1 Answers1

2

Try this:

@Model.item.sepordan_melk_foroshes.ghamat_total.ToString("N")

@Html.DisplayFor(model => item.sepordan_melk_foroshes.ghamat_total)

Or you can change your model, and add the format decoration to the attribute:

[DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)]
emerson.marini
  • 9,331
  • 2
  • 29
  • 46
  • It didn't Work :( it shows this Error message No overload for method 'ToString' takes 1 arguments – Ramin Sep 11 '13 at 13:59