all groups > asp.net datagrid control > july 2007 >
You're in the

asp.net datagrid control

group:

DataFormatString for currency?


DataFormatString for currency? Kat
7/8/2007 10:08:46 PM
asp.net datagrid control:
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.

Re: DataFormatString for currency? martin marinov
7/9/2007 12:00:00 AM
Hello Kat,

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

Martin

[quoted text, click to view]

Re: DataFormatString for currency? Kat
7/9/2007 8:10:06 AM
Not sure what you mean, when I use currency formats in other programs, such
as Excel, it works fine. What should I check?


[quoted text, click to view]

Re: DataFormatString for currency? marss
7/10/2007 12:04:04 AM
[quoted text, click to view]

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
AddThis Social Bookmark Button