Solved

How to convert Eval("Price") to 2 decimal places

Posted on 2009-05-12
4
1,438 Views
Last Modified: 2012-05-06
Hi All,

I am using C# and have the following within a repeater control:

<%# Eval("Price") %>

The underlying data type is MONEY and the value is currently returning 10.0000. How can I format this like 10.00?

Many thanks,

Rit
0
Comment
Question by:rito1
4 Comments
 
LVL 6

Accepted Solution

by:
ViceroyFizzlebottom earned 250 total points
ID: 24369060
Eval("Price", "{0:c}");
0
 
LVL 41

Assisted Solution

by:guru_sami
guru_sami earned 250 total points
ID: 24369248
You can also use String.Format function:

<%# String.Format("{0:C}",Eval("Price"))%>
0
 
LVL 1

Author Closing Comment

by:rito1
ID: 31580718
Excellent, thanks both.

Rit
0
 
LVL 11

Expert Comment

by:Muhammad Ousama Ghazali
ID: 24369803
For more information on Formatting Types especially the numeric ones see this link and browse for Standard or Cutsom formats.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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