任何人都可以知道吗?
输入的字符串是不正确的format.how解决?
protected void totalprice()
{
int quantity = 0;
int price = 0;
int rowTotal = 0;
int subTotal = 0;
int totalprice = 0;
foreach(GridViewRow row in GridView1.Rows)
{
quantity = Convert.ToInt32(row.Cells[3].Text); //replace 0 with row cell index of qty
price = Convert.ToInt32(row.Cells[4].Text); //replace 1 with row cell index of amount
rowTotal = quantity * price;
subTotal += rowTotal;
}
totalprice = subTotal;
lbltprice.Text = totalprice.ToString();
}