Solved

format a value as currency

Posted on 2011-02-26
3
249 Views
Last Modified: 2012-06-27
<font size="2"><%#Eval("Product_PRICE")%></font>

Product_Price gets returned from the sql server database which has a money datatype.  When it is returned using the above code it comes back something like this 34.440.  I would like it to be formated appropriately for example $33.44.  How would i do so?
0
Comment
Question by:vbnetcoder
3 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 34987550
try this code example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<script>
		function convertToCurrency()
		{
			var value = document.getElementById("amount1").innerHTML;
			document.getElementById("amount1").innerHTML = "$" + parseFloat(value) ;
		}
	</script>
</HEAD>

<BODY>
	<font id="amount1">34.440</font>
	<input type="button" onclick="convertToCurrency()" value="convert to currency"/>
</BODY>
</HTML>

Open in new window

0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 34987558
0
 

Author Closing Comment

by:vbnetcoder
ID: 34987730
ty
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question