DataFormatString for currency?

K

Kat

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.
 
M

martin marinov

Hello Kat,

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

Martin
 
K

Kat

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

marss

Kat said:
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
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top