Search code examples
c#asp.netdoublecurrencycurrency-formatting

How to show currency sign after the value on aspx page


I'm trying to show price <double> value on an .aspx page with this code:

<%# string.Format("{0:C2}", Eval("price")) %>

My current result:

$12.50

Expected result:

12.50$

Solution

  • You'll have to use decimal i think and put the dollar sign outside the formatting.

    <%# string.Format("{0}", Eval("price")) %>$
    
    <%# string.Format("{0:D}", Eval("price")) %>$ // ?
    

    Also check:

    <%# string.Format("{0:0.00}", Eval("price")) %>$