kiran kamble

kiran kamble

  • NA
  • 118
  • 1.4k

How can i do runtime calculation in gridview

Nov 17 2016 12:50 AM
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 

Attachment: GridCalculation.rar

Answers (2)