i'm doing a website to display products and prices and i encounter some error in calculation.
<asp:Button ID="SellPrice1"
Visible="true"
BackColor="#9933FF"
Width="200px"
BorderStyle="solid"
BorderColor="#ffffff"
BorderWidth="0px"
ForeColor="white"
Font-Underline="false"
runat="server"
CommandArgument='<%# Eval("Barcode")%>'
CommandName="Add"
Text='<%# "Normal price: RM" + String.Format("{0:0.00}", Convert.ToInt32(Eval("SellPrice_1")) * 1.06, "{0:0.00}") %>'
Font-Size="12px"
Font-Bold="true"></asp:Button>
<asp:Button ID="SellPrice2"
Visible="true"
BackColor="#9933FF"
Width="200px"
BorderStyle="solid"
BorderColor="#ffffff"
BorderWidth="0px"
ForeColor="white"
Font-Underline="false"
runat="server"
CommandArgument='<%# Eval("Barcode")%>'
CommandName="Add"
Text='<%# "Member price: RM" + Eval("SellPrice_2", "{0:0.00}") %>'
Font-Size="12px"
Font-Bold="true"></asp:Button>
Price of the first item: HEINZ SALAD CREAM ORIGINAL 285G (8.0189)
above is my source code to call 2 prices as show (Normal price, Member price) both data having the same amount currently.
As you guys can see, my normal price included tax which is the number 1.06. The code is working fine but when i count the actual amount by using a calculator, all calculations are wrong excluding the second which is 275.00 as the picture i attached shown.
so my question is, how can i make sure all the calculation can be correct? if my information is not clear enough please let me know.
I found out that my problem is actually the calculation round off all the decimal places only it calculate the amount. but how can i fix this?