I have below GridView, I want to add Tax into Total Column formula (Amount*Tax) = Total
Below html
<script type="text/javascript">
$(function () {
$("[id*=txtrate]").val("0");
});
$("body").on("change keyup", "[id*=txtrate]", function () {
//Check whether Quantity value is valid Float number.
var rate = parseFloat($.trim($(this).val()));
if (isNaN(rate)) {
rate = 0;
}
//Update the Quantity TextBox.
$(this).val(rate);
//Calculate and update Row Total.
var row = $(this).closest("tr");
$("[id*=lbtotal]", row).html(parseFloat($("td", row).eq(7).html()) * parseFloat($(this).val()));
//Calculate and update Grand Total.
var grandTotal = 0;
$("[id*=lbtotal]").each(function () {
grandTotal = grandTotal + parseFloat($(this).html());
});
$("[id*=lblGrandTotals]").html(grandTotal.toString());
//Calculate and update Row Total Last Coulmn.
var row = $(this).closest("tr");
$("[id*=lbtotal]", row).html(parseFloat($("td", row).eq(7).html()) * parseFloat($(this).val()));
//Calculate and update Grand Total.
var grandTotal = 0;
$("[id*=lbtotal2]").each(function () {
grandTotal = grandTotal + parseFloat($(this).html());
});
$("[id*=lblGrandTotal]").html(grandTotal.toString());
//Calculate %
});
</script>
<asp:GridView ID="gvSelected" runat="server" AutoGenerateColumns="false" Font-Names="Arial"
Font-Size="11pt" AlternatingRowStyle-BackColor="#C2D69B" HeaderStyle-BackColor="green"
EmptyDataText="No Records Selected" OnRowDataBound="gvSelected_RowDataBound"
ShowFooter="True" OnDataBound="gvSelected_DataBound">
<Columns>
<asp:BoundField ItemStyle-Width="0px" DataField="GRN_DID" HeaderText="ID" />
<asp:BoundField ItemStyle-Width="0px" DataField="GRN_ID" HeaderText="GRN" />
<asp:BoundField ItemStyle-Width="0px" DataField="It_ID" HeaderText="ITID" />
<asp:BoundField ItemStyle-Width="100px" DataField="imp_ibn_no" HeaderText="IB No" />
<asp:BoundField ItemStyle-Width="150px" DataField="imp_ibn_date" DataFormatString="{0:dd/MM/yyyy}"
HeaderText="IB Date" />
<asp:BoundField ItemStyle-Width="150px" DataField="It_Name" HeaderText="Name" />
<asp:BoundField ItemStyle-Width="30px" DataField="grn_qty" HeaderText="QTY" />
<asp:BoundField ItemStyle-Width="30px" DataField="Cont" HeaderText="Container" />
<asp:TemplateField HeaderText="Rate">
<ItemTemplate>
<asp:TextBox ID="txtrate" runat="server" Width="50px" Text='<%#Eval("txtrate")%>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Amount">
<ItemTemplate>
<asp:Label ID="lbtotal" runat="server" Width="50px" Text='<%#Bind("lbtotal")%>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lblGrandTotals" runat="server"></asp:Label>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tax">
<ItemTemplate>
<asp:Label ID="Im_Tax" runat="server" Width="50px" Text='<%#Eval("Im_Tax")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total">
<ItemTemplate>
<asp:Label ID="lbtotal2" runat="server" Width="50px" Text='<%#Bind("lbtotal2")%>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lblGrandTotal" runat="server"></asp:Label>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>