Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / DataGrid / July 2007

Tip: Looking for answers? Try searching our database.

DataFormatString for currency?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kat - 09 Jul 2007 05:08 GMT
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 - 09 Jul 2007 08:53 GMT
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 - 09 Jul 2007 15:10 GMT
Not sure what you mean, when I use currency formats in other programs, such
as Excel, it works fine.  What should I check?

> Hello Kat,
>
[quoted text clipped - 6 lines]
>> displaying as 19.0000.  I want it to be 19.00 like any normal
>> currency.  Thank you for your help.
marss - 10 Jul 2007 08:04 GMT
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.