Solved

format a value as currency

Posted on 2011-02-26
3
241 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 69

Accepted Solution

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

Author Closing Comment

by:vbnetcoder
ID: 34987730
ty
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now