Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1526
  • Last Modified:

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

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
rito1
Asked:
rito1
2 Solutions
 
ViceroyFizzlebottomCommented:
Eval("Price", "{0:c}");
0
 
guru_samiCommented:
You can also use String.Format function:

<%# String.Format("{0:C}",Eval("Price"))%>
0
 
rito1Author Commented:
Excellent, thanks both.

Rit
0
 
Muhammad Ousama GhazaliSolution Analyst & ArchitectCommented:
For more information on Formatting Types especially the numeric ones see this link and browse for Standard or Cutsom formats.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now