DataFormatString for currency?

Discussion in 'ASP .Net Datagrid Control' started by Kat, Jul 9, 2007.

  1. Kat

    Kat Guest

    I have tried to set a gridview column to have a dataformatstring of {0:c2},
    {0:c},{0:d2, {0:d}, none of which work, my values are still displaying as
    19.0000. I want it to be 19.00 like any normal currency. Thank you for
    your help.
     
    Kat, Jul 9, 2007
    #1
    1. Advertising

  2. Hello Kat,

    Are you sure that your seetings for the currency use dot for delimiter?

    Martin

    > I have tried to set a gridview column to have a dataformatstring of
    > {0:c2}, {0:c},{0:d2, {0:d}, none of which work, my values are still
    > displaying as 19.0000. I want it to be 19.00 like any normal
    > currency. Thank you for your help.
    >
     
    martin marinov, Jul 9, 2007
    #2
    1. Advertising

  3. Kat

    Kat Guest

    Not sure what you mean, when I use currency formats in other programs, such
    as Excel, it works fine. What should I check?


    "martin marinov" <> wrote in message
    news:...
    > Hello Kat,
    >
    > Are you sure that your seetings for the currency use dot for delimiter?
    >
    > Martin
    >
    >> I have tried to set a gridview column to have a dataformatstring of
    >> {0:c2}, {0:c},{0:d2, {0:d}, none of which work, my values are still
    >> displaying as 19.0000. I want it to be 19.00 like any normal
    >> currency. Thank you for your help.
    >>

    >
    >
     
    Kat, Jul 9, 2007
    #3
  4. Kat

    marss Guest

    Kat wrote:
    > Not sure what you mean, when I use currency formats in other programs, such
    > as Excel, it works fine. What should I check?


    You did everything right. But there is a feature that is poorly
    described in guides. If you want to use DataFormatString then you have
    to set
    HtmlEncode to false.

    <asp:BoundField .... HtmlEncode="False" DataFormatString="${0:C2}"/>

    Regards, Mykola
    http://marss.co.ua
     
    marss, Jul 10, 2007
    #4
    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. frank

    DataFormatString Doesn't Work

    frank, Sep 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    2,166
    Luc Kumps
    Sep 5, 2003
  2. victor nguyen
    Replies:
    1
    Views:
    4,179
    Rutger Smit
    Sep 11, 2004
  3. news.wanadoo.nl

    DataFormatString with euro as currency?

    news.wanadoo.nl, Feb 28, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,687
    JohnFol
    Feb 28, 2005
  4. Phillip Vong
    Replies:
    5
    Views:
    24,124
    KingSatan
    May 7, 2007
  5. Don

    DataFormatString shows currency, but without commas

    Don, Aug 26, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    268
    Raghavendra T V
    Aug 26, 2004
Loading...

Share This Page