Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET Databases
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET Databases Also see the forum ASP Databases for more general discussions of ASP database issues not directly related to these books.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Databases 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 Display Modes
  #1 (permalink)  
Old May 19th, 2009, 04:43 PM
Registered User
Join Date: May 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formatting an integer as 123,456

Does anyone know how to format an integer to include comma formatting? I.e. 123456 to 123,456.

I am populating a gridview from a code behind page in VB and using the code below to do some formatting, but cannot seem to figure out how to put in the commas in my numeric values.


'.... Formatting the rows. .................................................. ...............
If e.Row.RowType = DataControlRowType.DataRow And e.Row.Cells(1).Text <> "Totals"Then
x = 1
DoUntil x > 13
e.Row.Cells(x).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(x).Wrap =
e.Row.Cells(x).Font.Name = "verdana"
e.Row.Cells(x).Font.Size = FontUnit.Point(10)
e.Row.Cells(x).BackColor = Drawing.Color.AliceBlue
x = x + 1
Reply With Quote
  #2 (permalink)  
Old May 20th, 2009, 03:36 PM
Registered User
Join Date: May 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default OK, I figured it out

DataFormatString="{0:c}" or in the GridView Tasks box that is available when in Design View select "Edit Columns" then select the column you need to format and type {0:N0} in the "DataFormatString" field
Reply With Quote

Thread Tools
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
SQL Error, p. 456, step 16 member4953 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 April 8th, 2009 01:19 PM
Ch 12, Try It Out, p.456, Line 8 Different result VictorVictor BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 February 23rd, 2006 01:52 PM
formatting integer field gloribel Crystal Reports 1 October 13th, 2005 12:27 PM
123 IN LUCK C# 0 April 3rd, 2005 09:12 PM
Lotus 123 Workbook helga Pro VB 6 1 September 20th, 2004 08:30 PM

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

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