format number field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a number field with some numbers containing a decimal and some numbers
with no decimal. In the code behind I put it into a decimal variable and to
show this on a label I have the text of the label equal to this "Text='<%#
DataBinder.Eval(Container, "DataItem.Num") %>'"
SO, what comes to me is all numbers and 2 digits after decimals like this
100.00, 200.22, and 350.00
and what I want is ONLY the second one to have the decimal and the other 2
to just show round numbers like 100, 200.22, and 350. Any ideas how I can
accomplish this? It looks how I want it in SQL Server, just getting it to
display this way is my issue. Is using a decimal behind the scenes my
problem?
Thanks!
 
Try:

DataBinder.Eval(Container, "DataItem.Num", "{0:###.###}")

if it's possible for the # to be >= 1000 you'll want to add extra # before
the decimal..

Karl
 
THANK YOU!!

Karl Seguin said:
Try:

DataBinder.Eval(Container, "DataItem.Num", "{0:###.###}")

if it's possible for the # to be >= 1000 you'll want to add extra # before
the decimal..

Karl
 

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

Back
Top