\r\n\r\n
Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > ASP.Net > Rounding off Curency


\r\n \r\n
 
 
Thread Tools Display Modes

\r\n\r\n\r\n
I am using this:
\r\n
\r\n<%# DataBinder.Eval(Container.DataItem, "Price","{0:c}") %>
\r\n
\r\nto bind an item in a repeater control.
\r\nI need to round off the decimal to either .99 or .00 only.
\r\nI can\'t change this through the stored procedure as other items use the \'raw\' format.
\r\nI have tried converting to double so I can use Math.Round but that rounds off to the nearest dollar with no decimals.
\r\nI have researched other numeric formats but none has anything about rounding off the decimals.
\r\n
\r\nThanks in advance.
\r\n
\r\nEduardo
\r\n \r\n\r\n
\r\n \r\n\r\n \r\n \r\n\r\n \r\n \r\n
\r\n __________________
\r\n Pinoy ako.. ipinagmamalaki ko.\r\n
\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n
\r\n \r\n \r\n \r\n \r\n Reply With Quote\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n'; pd[1279943] = '\r\n\r\n \r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n
\r\n
\r\n  \r\n #2  \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Old\r\n \r\n 03-24-2008, 11:12 AM\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n shaul_ahuva\r\n shaul_ahuva is offline\r\n\r\n\r\n
Prev Previous Post   Next Post Next
  #1  
Old 03-04-2008, 11:58 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default Rounding off Curency


I am using this:

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

to bind an item in a repeater control.
I need to round off the decimal to either .99 or .00 only.
I can't change this through the stored procedure as other items use the 'raw' format.
I have tried converting to double so I can use Math.Round but that rounds off to the nearest dollar with no decimals.
I have researched other numeric formats but none has anything about rounding off the decimals.

Thanks in advance.

Eduardo
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->