Format DataItem as Currency and NO decimals

D

D. Shane Fowlkes

Quick question -

I have output from a Money MS SQL field going into a repeater's dataitem.
The db does not store any cents (decimals). How can I get this on the page:

<%#DataBinder.Eval(Container.DataItem, "Revenue", "{0:C}")%>

...NOT to display any decimals or cents?
 
N

Nathan Sokalski

Rather than try to convert the value to Currency, simply prepend it with a $
like the following:

<%#DataBinder.Eval(Container.DataItem, "Revenue", "${0}")%>

If you would like, you can specify that an integer format be used (such as
"${0:D}"). For more information, see

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconstandardnumericformatstrings.htm

Good Luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top