How to format calculated value as decimal in mvc3/razor/webgrid?
How can I get this to show as a dec开发者_Python百科imal in mvc3/razor/webgrid helper?
grid.Column("DecimalValue", format: @<text>@((@item.SomeInt / @item.SomeInt2))</text>)
You will need to cast to decimal, or you will only do integer arithmetic, which by definition returns an integer.
Not quite sure razor syntax will allow this (if not, use a code block @{})
@(decimal)item.SomeInt / @item.SomeInt2
精彩评论