DataFormatString question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pvong

    #1

    DataFormatString question

    I have a Gridview that I want to format the values so it looks like this.

    Currently What I Want
    25.6 25.60%
    1.2 1.20%
    100 100.00%

    Basically, I always want two zeros after the decimal.
    I know {0:c} does currency and {0:d} does dates. What converts decimals?

    According to this site, I'm suppose to use {0:d} which is already taken by
    date.
    http://msdn.microsoft.com/en-us/libr...matstring.aspx



  • Mark Rae [MVP]

    #2
    Re: DataFormatStrin g question

    "pvong" <phillip*at*yah oo*dot*comwrote in message
    news:%23JLtFhDR JHA.588@TK2MSFT NGP06.phx.gbl.. .
    Basically, I always want two zeros after the decimal.
    I know {0:c} does currency and {0:d} does dates. What converts decimals?
    >
    According to this site, I'm supposed to use {0:d} which is already taken
    by date.
    http://msdn.microsoft.com/en-us/libr...matstring.aspx
    No. If you read the site again carefully, you'll see that what you're
    supposed to use is {0:D}, not {0:d}


    --
    Mark Rae
    ASP.NET MVP


    Comment

    Working...