title: Multiply quantity with price and display total
body: <p>In the gridview i have an edit button when i click that the two fields will change to textboxes quantity and total.. when the user edits the quantity total has to be calculated automatically and display the result in the total field.. but i am getting the error in the line</p>
  
  <pre><code>decimal price= Convert.ToDecimal(row.Cells[1].Text.Replace("$",  String.Empty).Replace(",", String.Empty));
  </code></pre>
  
  <p>input string was not in a correct format
  here is the code</p>
  
  <pre><code>protected void txtQuantity_TextChanged(object sender, EventArgs e)
  {
      TextBox txtQuantity = (TextBox)sender;
      GridViewRow row = (GridViewRow)txtQuantity.NamingContainer;
      TextBox txtTotal = (TextBox)row.FindControl("txtTotal");
      decimal price = Convert.ToDecimal(row.Cells[1].Text.Replace("$",  String.Empty).Replace(",", String.Empty));
      decimal total = price * Convert.ToInt32(txtQuantity.Text);
  
      txtTotal.Text = string.Format("{0:C}", total);
  }
  </code></pre>