DataFormatString Question #2 Forcing Currency Format

P

Phillip Vong

VS2005 and SQL2000

Have a column with Data Type "Float". Example, the value in the row could be
80025.36958
or
123.5
etc.

Using a Gridview, I want to force this column to return as currency.

1) I've tried {0:c}
This does absolutely nothing. Returns all the number as is.

2) I forced it to ruturn with ${0:c2}.
This will return the numbers with $ but does not round to 0.XX and if a
number does not have 0.XX like 123.5, then I only get $123.5 and I want to
get $123.50. Also, the 80025.36958 example from above returns as
$80025.336958. I want to make it seperate the thousands by comma. Basically,
I'm looking for the standard format of $80,025.37.

Can someone help?

Thanks!

Phil
 
P

Phillip Vong

Mark,
Thanks for the reply, but that did not help at all. I'm still getting
results like 80025.336958.

Someone Please help. I'm doing this in VS2005.
 
P

Phillip Vong

Mark, Thanks! You actually solved my problem by reminding me to make
HtmlEncode="False". I just left the format as {0:c} and everything worked.

Thanks!
 
Joined
May 7, 2007
Messages
1
Reaction score
0
im using vs2003 c# and sql server 2000
and i used
<asp:BoundColumn DataFormatString={0:"#,##0.00"} DataField="chrPriceRange"></asp:BoundColumn>
in the asp part of my wep project i also used
<asp:BoundColumn DataFormatString="{0:$#,###,###.00}"
and <asp:BoundColumn DataFormatString="{0:C}"
and none of them did a thing
the datagrid always displayed the numbers the same as the input no matter what no $ or ,'s
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top