Tuesday 15 January 2013

c# - Formatting a Nullable Decimal in a Razor View in ASP.NET -



c# - Formatting a Nullable Decimal in a Razor View in ASP.NET -

i have asp.net mvc app. app using razor in views. trying display decimal?. twist on not want show decimals. in other words, if nullable decimal value 567.89, want display 567. currently, have plain old:

<div class="icon">@model.count</div>

this approach displays 567.89. how format nullable decimal show whole number portion?

thank you!

you can utilize string.format display decimal? out decimals.

@string.format("{0:0}", 567.89)

will display 567

c# asp.net-mvc

No comments:

Post a Comment