Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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('-', ',')));

}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900