private void ddlAmount_SelectedIndexChanged(object sender, EventArgs e) { //Get ID of product that has had its quantity dropdownlist changed. DropDownList selectedList = (DropDownList)sender; int cartId = Convert.ToInt32(selectedList.ID); int quantity = Convert.ToInt32(selectedList.SelectedValue); //Update purchase with new quantity and refresh page PurchaseCtrl purchase = new PurchaseCtrl(); purchase.updateInventory(cartId, quantity); Response.Redirect("~/Pages/ShoppingCart.aspx"); }
public void updateInventory(int id, int quantity) { PurchaseCtrl p = new PurchaseCtrl(); p.updateInventory(id, quantity); }