Format DataItem as Currency and NO decimals

Discussion in 'ASP .Net' started by D. Shane Fowlkes, Mar 20, 2006.

  1. 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?
    D. Shane Fowlkes, Mar 20, 2006
    #1
    1. Advertising

  2. 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!
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "D. Shane Fowlkes" <> wrote in message
    news:e4ja$...
    > 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?
    >
    >
    >
    >
    >
    >
    >
    >
    Nathan Sokalski, Mar 21, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hansiman
    Replies:
    1
    Views:
    19,367
    =?Utf-8?B?S2VuIENveCBbTWljcm9zb2Z0IE1WUF0=?=
    Oct 8, 2004
  2. D. Shane Fowlkes

    Format DataItem 'inline' as Currency/String?

    D. Shane Fowlkes, Jun 9, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,888
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Jun 9, 2005
  3. JeffP@Laptop

    How do I Format Currency w/out decimals?

    JeffP@Laptop, Dec 13, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    15,725
    =?Utf-8?B?RWx0b24gVw==?=
    Dec 15, 2005
  4. Tang Chun Chung

    Re: Format decimals places

    Tang Chun Chung, Jun 28, 2003, in forum: Java
    Replies:
    0
    Views:
    962
    Tang Chun Chung
    Jun 28, 2003
  5. JDC
    Replies:
    3
    Views:
    438
    Damien
    Jun 28, 2006
Loading...

Share This Page