Solved

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

Posted on 2009-05-12
4
1,416 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

8 Experts available now in Live!

Get 1:1 Help Now