473,811 Members | 3,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I Format Currency w/out decimals?

In the datagrid I have

$320.00

from...

<asp:Label ... Text='<%# DataBinder.Eval (Container, "DataItem.Insta ll_1",
"{0:c}") %>' ...>

How can I get: $320

TIA

JeffP....


Dec 13 '05 #1
3 4873
Try

<%# DataBinder.Eval (Container, "DataItem.Insta ll_1", "{0:$###### }") %>
Some thing like
<%# DataBinder.Eva( Container, "DataItem.Insta ll_1", "{0:$###,##0.00 }") %>

gives you

$5,320.00

HTH

Elton Wang
"JeffP@Lapt op" wrote:
In the datagrid I have

$320.00

from...

<asp:Label ... Text='<%# DataBinder.Eval (Container, "DataItem.Insta ll_1",
"{0:c}") %>' ...>

How can I get: $320

TIA

JeffP....



Dec 13 '05 #2
JDP
That didn't work in all cases, and caused an error in my sub & grand totals.

If say the value was null, my string would be '$' and it'd error in my +=
replace(field, "$", 0)

Instead....

<asp:Label ..... Text='<%# formatMoney(Con tainer.DataItem ("Install_1" )) %>'>

....vb code behind....
Protected Function formatMoney(ByV al data as Object) As String
Dim retVal as String = ""
If Not data Is DBNull.Value Then
retVal = FormatCurrency( data, 0)
End If
Return retVal
End Function

TIA

JeffP.....

"Elton W" <El****@discuss ions.microsoft. com> wrote in message
news:72******** *************** ***********@mic rosoft.com...
Try

<%# DataBinder.Eval (Container, "DataItem.Insta ll_1", "{0:$###### }") %>
Some thing like
<%# DataBinder.Eva( Container, "DataItem.Insta ll_1", "{0:$###,##0.00 }") %>

gives you

$5,320.00

HTH

Elton Wang
"JeffP@Lapt op" wrote:
In the datagrid I have

$320.00

from...

<asp:Label ... Text='<%# DataBinder.Eval (Container, "DataItem.Insta ll_1",
"{0:c}") %>' ...>

How can I get: $320

TIA

JeffP....



Dec 14 '05 #3
You should get sub & grand totals based on underlying data source, e.g.
datatable or dataset, rather than datagrid itself.

HTH

Elton Wang

"JDP@Work" wrote:
That didn't work in all cases, and caused an error in my sub & grand totals.

If say the value was null, my string would be '$' and it'd error in my +=
replace(field, "$", 0)

Instead....

<asp:Label ..... Text='<%# formatMoney(Con tainer.DataItem ("Install_1" )) %>'>

....vb code behind....
Protected Function formatMoney(ByV al data as Object) As String
Dim retVal as String = ""
If Not data Is DBNull.Value Then
retVal = FormatCurrency( data, 0)
End If
Return retVal
End Function

TIA

JeffP.....

"Elton W" <El****@discuss ions.microsoft. com> wrote in message
news:72******** *************** ***********@mic rosoft.com...
Try

<%# DataBinder.Eval (Container, "DataItem.Insta ll_1", "{0:$###### }") %>
Some thing like
<%# DataBinder.Eva( Container, "DataItem.Insta ll_1", "{0:$###,##0.00 }") %>

gives you

$5,320.00

HTH

Elton Wang
"JeffP@Lapt op" wrote:
In the datagrid I have

$320.00

from...

<asp:Label ... Text='<%# DataBinder.Eval (Container, "DataItem.Insta ll_1",
"{0:c}") %>' ...>

How can I get: $320

TIA

JeffP....




Dec 15 '05 #4

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

Similar topics

1
3326
by: Hung Huynh | last post by:
Is there an easy way to change Currency formatting from USD to EUR (use comma as decimals delimiter instead of period)? I'm using Windows 2000 Server/IIS 5.0 in English. I'm serving both USD and EUR dynamically from the same source codes. I'd like to change Currency formatting automatically when a person chooses EUR. Thanks! HH
2
2240
by: DD | last post by:
I have a UnionQry that is run from StatementsI and StatementP. the Due and Paid colunms are currency and show the $ however when i union the two the currency format has gone. Any help please SELECT * FROM qryStatementI UNION SELECT * FROM qryStatementP ORDER BY thedate;
1
2541
by: John Marble | last post by:
I looked around for a way to change the format and the decimal setting of a REAL type variable, but I can't seem to be able to find the synthax anywhere. Here is an exemple of what I am doing: ALTER TABLE MAIN ALTER COLUMN sup_visee REAL; It works, it changes the column "sup_visee" which was a String into a REAL. What I want to do too is to be able to set the REAL format to
2
2514
by: VB Programmer | last post by:
I have a datalist that contains a label for each time to hold pricing info. In the Access db everything is stored in a currency format. But, when the label displays the info it's not in currency format, with 2 decimals, etc... Any ideas how I can force the label to display a currency format? Thanks!
1
1517
by: Dave Wurtz | last post by:
All, I have a NumberFormatInfo object with specific setting (i.e. number of decimals, thousands separator, decimal separator, currency symbols, etc.) based upon my application, not my system's setting. Is there any methods, etc. to get a string that contains the format based upon this object? For example, if my decimals are set to 3, can I somehow have this
6
9559
by: Mitchell Vincent | last post by:
Just making sure I'm not missing the boat here, but are there any special routines for doing currency math (fixed precision stuff) in .NET? The wonderful problems of doing math on decimals tend to shine when writing accounting software :-) How are others dealing with this? -- - Mitchell Vincent
1
2718
by: D. Shane Fowlkes | last post by:
Quick question - I have output from a Money MS SQL field going into a repeater's dataitem. The db does not store any cents (decimals). How can I get this on the page: <%#DataBinder.Eval(Container.DataItem, "Revenue", "{0:C}")%> ...NOT to display any decimals or cents?
2
1588
by: crferguson | last post by:
Hello all! I'm having the oddest issue trying to format a numeric string as currency without decimals. For instance... strSalary = "120000.56" strSalary = Format(strSalary, "$#,##0") 'this one returns "$#,##0" literally, no number strSalary = Format(strSalary, "C0") 'this one returns "C0" literally, no number
2
1781
by: labcheung | last post by:
Hi all: I am working on Access 2000 with SP3. The problem is the sum of currency has $0.01 difference on the total even I use the same equation on all forms. I have a product which costs $538.20, then add two taxes (7% ---$37.67 and 6% ---$32.29) and the total amount should be $608.16. Total=Subtotal (1 + Tax1 +Tax2) all controls are formated as currency. $608.16 = $538.20 + $37.67 + $32.29
7
8763
by: Dag Sunde | last post by:
I want to use the format-number function to output a number with a specific number of decimals, based on the content of a node... Is there any smart way to generate differnet strings based on a node-value? if decimals = 0, I want "###,###" decimals = 1, I want "###,###.0" decimals = 2, I want "###,###.00" decimals = n, I want "###,###.000..n"
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7673
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.