When requesting the data from the database, divide it by 100. For example:
SELECT CAST(cents AS money) / 100 AS dollars
FROM Table
--
Browse
http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"peter@eway.com.au" wrote:
Quote:
Hi, I currently have a field which stores an amount in the database as
an integer. It is stored as cents, so 155 in the databse it is really
$1.55.
>
Problem is when I Bind it to a datagrid using the Text='<%#
Bind("RecurringPaymentAmount", "{0:c2}") %>'>, it displays as $155.00
instead of $1.55.
>
Any idea how to easily format this so it displays correctly.
>
Thanks in advance.
>
Peter.
>
<asp:TemplateField HeaderText="Recurring Amount"
SortExpression="RecurringPaymentAmount">
<ItemTemplate>
<asp:Label ID="lblRecurringPaymentAmount" runat="server"
Text='<%# Bind("RecurringPaymentAmount", "{0:c2}") %>'></asp:Label>
</ItemTemplate>
<asp:TemplateField>
>
>