Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2007, 03:24 PM
Registered User
 
Join Date: Sep 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formatting currency

I am working through the e-commerce chapter (ch. 13) and am trying to format the Price and Total columns in the shopping cart display. I have DataFormatString for those two columns set to "{0,c}". I have tried other values too, but nothing that I do changes the display. It's always without the leading dollar sign and without the zero for cents for a number like "7.9". How do I format the column values such as what I'm describing?
 
Old September 20th, 2007, 03:27 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Is the value you are trying to format a string or a double??

Normally I do something like this:

String.Format("{0:c}", Convert.ToDouble("7.5"));

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old September 20th, 2007, 04:59 PM
Registered User
 
Join Date: Sep 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your response.

In the Shopping class, there is a variable called "_LineTotal" which is a Double. This has been added as a Field to a GridView control. When I Edit Columns for the GridView and select this field, I have entered "{0:c}" in the DataFormatString property. I'm not sure where to use the sample line you put in your message, since I'm not formatting the column in code but in a control's properties. I would appreciate any further help you can give me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Currency mjbkelly Beginning VB 6 1 March 22nd, 2007 07:14 AM
ADO2.6 currency formatting dgulliver VB How-To 2 October 31st, 2006 07:20 PM
XSQL date and currency formatting c3008212 XSLT 0 March 18th, 2006 08:52 AM
Formatting currency chelechele JSP Basics 0 April 5th, 2005 06:00 PM
Currency value in textboxes mahulda ASP.NET 1.0 and 1.1 Basics 1 April 6th, 2004 02:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.