c# - linq sum how to display as currency -


i have following in razor view:

<td>@payments.sum(p => p.amount)</td> 

i want display currency have '$' , 2 decimals on end.

i think go {0:c}.

i don't know how incorporate i've got sum not have overload format.

do need css class?

you this:

<td>@string.format("{0:c}", payments.sum(p => p.amount))</td> 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -