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

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

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -