int R,Q,T=0;
protected void Gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TextBox txtRate = (TextBox)e.Rows.FindControl("txtRate");
TextBox txtQuantity = (TextBox)e.Rows.FindControl("txtQuantity");
TextBox txtTotal = (TextBox)e.Rows.FindControl("txtTotal");
int R = int.Parse(txtRate.Text);
int Q = int.Parse(txtQuantity.Text);
T += Convert.ToInt32(R * Q);
txtTotal.Text = T.ToString();
}
}
its showing FormatException was unhandled by user code and input string was not in coorect format and sir this calculation is not working on runtime, because database table is empty and i want to enter the number in runtime, if i enter Quantity "1" and Rate "200" then im pressing the tab i want result in next column

JohnRank #2,322 · 608 reputationPosted Nov 16, 2016, 8:45 PM EST
This is what i did on rowdatabound and worked for me
- Take R as decimal (as u have declared it money in database) and while finding control use Row instead of Rows
kiran kamble67 reputationPosted Nov 17, 2016, 8:11 PM EST