Solved

Format Function

Posted on 2006-07-15
5
260 Views
Last Modified: 2011-10-03
I need examples of how to format the following:

it returns 0.668217551740735 now if have been

how do i round it off to .66

how about 66% (i have been fooling with the PERCENT Format name with no luck

<%# DataBinder.Eval(Container.DataItem, "unitcost", "{0:f}") / DataBinder.Eval(Container.DataItem, "retailprice") %>
0
Comment
Question by:dplsr
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:Ramuncikas
Comment Utility
>>> how do i round it off to .66
<%# DataBinder.Eval(Container.DataItem, "MyField", "{0:N2}") %>

>>> how about 66%
<%# CInt(DataBinder.Eval(Container.DataItem, "MyField") * 100) & "%" %>
0
 

Author Comment

by:dplsr
Comment Utility

Hi Ramuncikas

this is still returning:  0.668217551740735

<%# DataBinder.Eval(Container.DataItem, "unitcost", "{0:N2}") / DataBinder.Eval(Container.DataItem, "retailprice" %>
0
 
LVL 14

Accepted Solution

by:
Ramuncikas earned 500 total points
Comment Utility
<%# String.Format("{0:#0.00", DataBinder.Eval(Container.DataItem, "unitcost") / DataBinder.Eval(Container.DataItem, "retailprice") %>
0
 

Author Comment

by:dplsr
Comment Utility
got it after a couple of fixes!

<%# String.Format("{0:#0.00}", DataBinder.Eval(Container.DataItem, "unitcost") / DataBinder.Eval(Container.DataItem, "retailprice")) %>
thanks!
0
 
LVL 14

Expert Comment

by:Ramuncikas
Comment Utility
Was writing from mind, sorry for mistakes.
Thanks for points and good luck
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

16 Experts available now in Live!

Get 1:1 Help Now