Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Format DataItem as Currency and NO decimals

Reply
Thread Tools

Format DataItem as Currency and NO decimals

 
 
D. Shane Fowlkes
Guest
Posts: n/a
 
      03-20-2006
Quick question -

I have output from a Money MS SQL field going into a repeater's dataitem.
The db does not store any cents (decimals). How can I get this on the page:

<%#DataBinder.Eval(Container.DataItem, "Revenue", "{0:C}")%>

...NOT to display any decimals or cents?








 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      03-21-2006
Rather than try to convert the value to Currency, simply prepend it with a $
like the following:

<%#DataBinder.Eval(Container.DataItem, "Revenue", "${0}")%>

If you would like, you can specify that an integer format be used (such as
"${0}"). For more information, see

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconstandardnumericformatstrings.htm

Good Luck!
--
Nathan Sokalski
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/

"D. Shane Fowlkes" <(E-Mail Removed)> wrote in message
news:e4ja$(E-Mail Removed)...
> Quick question -
>
> I have output from a Money MS SQL field going into a repeater's dataitem.
> The db does not store any cents (decimals). How can I get this on the
> page:
>
> <%#DataBinder.Eval(Container.DataItem, "Revenue", "{0:C}")%>
>
> ..NOT to display any decimals or cents?
>
>
>
>
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Always display decimals using UK/US format? JDC ASP .Net 3 06-28-2006 02:14 PM
How do I Format Currency w/out decimals? JeffP@Laptop ASP .Net 3 12-15-2005 02:06 AM
Format DataItem 'inline' as Currency/String? D. Shane Fowlkes ASP .Net 1 06-09-2005 04:05 PM
String format, thousand separator and decimals hansiman ASP .Net 1 10-08-2004 07:29 PM
Re: Format decimals places Tang Chun Chung Java 0 06-28-2003 06:09 AM



Advertisments