Solved

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

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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 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