Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 20th, 2007, 03:24 PM
Registered User
 
Join Date: Sep 2007
Location: , , .
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?
  #2 (permalink)  
Old September 20th, 2007, 03:27 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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

================================================== =========
  #3 (permalink)  
Old September 20th, 2007, 04:59 PM
Registered User
 
Join Date: Sep 2007
Location: , , .
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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:18 PM.


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