Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Formatting decimals with 2 digits - 3.70 vs 3.7000 ???

Reply
Thread Tools

Formatting decimals with 2 digits - 3.70 vs 3.7000 ???

 
 
Todd
Guest
Posts: n/a
 
      11-24-2003
I am formatting decimals on several columns within my DataGrid. For
the most part it is working correctly. However, 2 of the columns will
not format correctly. For example: the two columns that aren't
formating correctly are displaying 4 decimal places to the right.
Instead of getting: 3.70 I am getting 3.7000.

I am using the {0:F2} within the dataGrid property builder to get 2
decimal places to the right of the decimal point. This for some
reason is being "ignored" by my two troublesome columns, but works for
all the other decimal columns. Why would this work for some values,
and not others?
I have tried several different formatting functions inside the
code-behind page too, such as: format(value, F2) but that didn't work.
I have also tried using the D2 option but that doesn't work. For
some reason it is only occuring on these two decimal columns. Anyone
know why I get 4 decimal places instead of the two? And why does it
only happen on these 2 and not all the decimal values?
 
Reply With Quote
 
 
 
 
Mel Freeman
Guest
Posts: n/a
 
      11-25-2003
I don't know if this is any help, but this format string worked for me...

<%# DataBinder.Eval(Container, "DataItem.AWARD", "{0:#0.00}") %>

Mel.

http://www.velocityreviews.com/forums/(E-Mail Removed) (Todd) wrote in message news:<(E-Mail Removed). com>...
> I am formatting decimals on several columns within my DataGrid. For
> the most part it is working correctly. However, 2 of the columns will
> not format correctly. For example: the two columns that aren't
> formating correctly are displaying 4 decimal places to the right.
> Instead of getting: 3.70 I am getting 3.7000.
>
> I am using the {0:F2} within the dataGrid property builder to get 2
> decimal places to the right of the decimal point. This for some
> reason is being "ignored" by my two troublesome columns, but works for
> all the other decimal columns. Why would this work for some values,
> and not others?
> I have tried several different formatting functions inside the
> code-behind page too, such as: format(value, F2) but that didn't work.
> I have also tried using the D2 option but that doesn't work. For
> some reason it is only occuring on these two decimal columns. Anyone
> know why I get 4 decimal places instead of the two? And why does it
> only happen on these 2 and not all the decimal values?

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
String Formatting Operations for decimals. Lacrima Python 1 04-01-2010 09:14 AM
formatting floating numbers into 7 digits? Ingo Nolden C++ 2 05-15-2005 05:47 PM
asp.net text box for decimals Brent Burkart ASP .Net 1 11-12-2003 07:11 PM
Re: Formatting Decimals Kevin Spencer ASP .Net 0 08-26-2003 04:14 PM
Formatting Decimals Kerri ASP .Net 1 08-21-2003 07:05 PM



Advertisments