Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.Net: Eval Format for money expressions

Tags:

asp.net

how I can format my database-query in a list view with 2 signs after comma?

Now: 100 Should be: 100,00

Now: 75,3 Should be: 75,30

How I get it when I insert the data in the list view with Eval(xxx)?

like image 423
PassionateDeveloper Avatar asked Nov 05 '09 13:11

PassionateDeveloper


2 Answers

<%# Eval("myField", "{0:c}") %>

will format the value using the locale-specific currency settings.

like image 70
pmarflee Avatar answered Nov 12 '22 07:11

pmarflee


this will give you the exact format you are looking for:

<%# Eval("currency", "{0:0,00}") %>

or this will give you the amount in the local currency (based on the webserver's locale).

<%# Eval("currency", "{0:c}") %>
like image 16
Colin Pickard Avatar answered Nov 12 '22 06:11

Colin Pickard