Solved

format a value as currency

Posted on 2011-02-26
3
253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article discusses how to create an extensible mechanism for linked drop downs.
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…
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).

726 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