i have 4 columns in gridview like this products, rate, quantity, amount
i want how to calculate amount after rate and quantity multiply i am using template field
kindly, help me i am new
What I have tried:
<asp:GridView ID="GridView1" runat="server" ondatabound="GridView1_DataBound"
onrowdatabound="GridView1_RowDataBound"
onselectedindexchanged="GridView1_SelectedIndexChanged">
<columns> <asp:TemplateField HeaderText="Item Name">
<itemtemplate>
<asp:DropDownList ID="cbGvProd" runat="server" Height="16px" Width="200px">
<asp:TemplateField HeaderText="Quantity">
<itemtemplate>
<asp:TextBox ID="tbQty" runat="server">
<asp:TemplateField HeaderText="Rate">
<itemtemplate>
<asp:TextBox ID="tbRate" runat="server">
<asp:TemplateField HeaderText="Amount">
<itemtemplate>
<asp:TextBox ID="tbAmount" runat="server">
for (int i = 0; i < GridView1.Rows.Count; i++)
{
GridView1.Rows[i].Cells[3].Text = Convert.ToString(Convert.ToInt32(GridView1.Rows[i].Cells[1].Text.Replace('-', ',')) * Convert.ToDouble(GridView1.Rows[i].Cells[2].Text.Replace('-', ',')));
}