p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET Databases
I forgot my password Register Now
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 19th, 2009, 05:43 PM
Registered User
Points: 26, Level: 1
Points: 26, Level: 1 Points: 26, Level: 1 Points: 26, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.

Thanks!

'.... 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 =
"False"
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
Loop
EndIf
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old May 20th, 2009, 04:36 PM
Registered User
Points: 26, Level: 1
Points: 26, Level: 1 Points: 26, Level: 1 Points: 26, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 02: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 02:52 PM
formatting integer field gloribel Crystal Reports 1 October 13th, 2005 01:27 PM
123 IN LUCK C# 0 April 3rd, 2005 10:12 PM
Lotus 123 Workbook helga Pro VB 6 1 September 20th, 2004 09:30 PM



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


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc