[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

format a value as currency

Posted on 2011-02-26
3
Medium Priority
?
264 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:Gurvinder Pal Singh
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 2000 total points
ID: 34987558
0
 

Author Closing Comment

by:vbnetcoder
ID: 34987730
ty
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

830 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