Solved

format a value as currency

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

911 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

20 Experts available now in Live!

Get 1:1 Help Now