public void UpdateProductTable() { foreach (GridViewRow row in grdOrder.Rows) { int quantity = int.Parse(row.Cells[6].Text); int productId = int.Parse(row.Cells[3].Text); tblProduct = adpProduct.GetDataBy(productId); int prodInStock = tblProduct[0].ProductInStock - quantity; adpProduct.UpdateByProductID(prodInStock, productId); } Response.Redirect("~/OrderForm.aspx"); }