473,327 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

format number field

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!
May 3 '06 #1
2 1917
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

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Carrie" <Ca****@discussions.microsoft.com> wrote in message
news:B7**********************************@microsof t.com...
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!

May 3 '06 #2
THANK YOU!!

"Karl Seguin [MVP]" wrote:
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

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Carrie" <Ca****@discussions.microsoft.com> wrote in message
news:B7**********************************@microsof t.com...
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!


May 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Colin Steadman | last post by:
I'm a stupid ASP programmer and I dont do Javascript (except for very simple tasks anyway), and I'm in a bit of a predicament. I've used a javascript table sorting script from here: ...
3
by: John H. | last post by:
Hi, Why if set a DataTable in Crystal Report Net Table with method SetDataSource, 'ReportDocument.SetDataSource(oDataTable)', lost the Number and Currency format with the decimal digits and...
5
by: Macca | last post by:
Hi, I have a table which has a date/time field. I am storing them as follows :- 01/01/2005 11:25 01/01/2005 19:44 02/01/2005 05:04
2
by: junkaccount | last post by:
Hello, I currently have a field named QuoteNumber in a table named Quotes. The field is set as autonumber and is used to assign sequential numbers as users enter information in the table through...
6
by: Ted | last post by:
I used bcp to produce the apended format file. How can it be modified to recognize the quotes that surround the text fields and not insert the quotes along with the text? Invariably, the first...
6
by: JFB | last post by:
Hi all, How can I format a fax number as 888-333-444? The number is coming from database as 8883334444 <ItemTemplate> <%#container.dataItem("cfax")%> </ItemTemplate> Tks JFB
0
by: Wayne | last post by:
I am charting data from a query that consists of a Date/Time field and a Number field. The Date/Time field is the x scale on my chart. Sometimes data is collected from different times during the...
10
by: Dixie | last post by:
I am appending some new fields to a table in vba and when I append a number field with is a byte, it does not inherit any format. I want it to be the General Number format, but it is blank. I...
18
by: Dirk Hagemann | last post by:
Hello, From a zone-file of a Microsoft Active Directory integrated DNS server I get the date/time of the dynamic update entries in a format, which is as far as I know the hours since january 1st...
2
by: piotr.kabath | last post by:
Hi I have date stored as number in yyyymm format, as I need to calculate previous month\ prev 3 months etc, I need to convert this to date format yyyymm. I have tried but with no success, I would...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.