In a SQL table I have a field that is decimal datatype.
I have two rows with data and some amounts.
These amounts are recorded in the table as 55.53600 and 144.99600. Add these two numbers together and you get £200.53.
However, when I display the information on a .net page, the amounts seem to round up to £55.54 and £145.00 respectively. Which add them together and you get £200.54. So I am a penny out. It rounds the numbers up if displaying in a datagrid.
However if I want to display just the total spent in a datalist, then then it displays the raw data from the table - £200.53 not the £200.54 as shown in the datagrid.
How can this be. Is there are way I can round the datalist as well.
My code for the datalist to display the info is
My code in the datagrid is:
I have two rows with data and some amounts.
These amounts are recorded in the table as 55.53600 and 144.99600. Add these two numbers together and you get £200.53.
However, when I display the information on a .net page, the amounts seem to round up to £55.54 and £145.00 respectively. Which add them together and you get £200.54. So I am a penny out. It rounds the numbers up if displaying in a datagrid.
However if I want to display just the total spent in a datalist, then then it displays the raw data from the table - £200.53 not the £200.54 as shown in the datagrid.
How can this be. Is there are way I can round the datalist as well.
My code for the datalist to display the info is
Code:
<asp:Label ID="OverallTotalSpentLabel" runat="server"
Text='<%# Eval("OverallTotalSpent", "{0:C}") %>' />
My code in the datagrid is:
Code:
asp:BoundField DataField="Order_Amount" HeaderText="Amount"
SortExpression="Order_Amount" dataformatstring="{0:c}"
HtmlEncode="False" >
<HeaderStyle Width="90px" HorizontalAlign="Right" />
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>