protected void UpdatePrice_Click(object sender, EventArgs e) { try { double price = Convert.ToDouble(Price.Text); if (price < 0) { InvalidSelectionError(); } else { Products product = ProductsDA.GetProductByID(Convert.ToInt32(MenuItemID.Text)); product.ProductPrice = price; ProductsDA.UpdateProduct(product); Price.Text = ""; MenuItemID.Text = ""; MenuItemName.Text = ""; PriceTable.Visible = false; ItemTable.Visible = false; } } catch (Exception ex) { InvalidSelectionError(); } }
protected void EditItem_Click(object sender, EventArgs e) { Products product = ProductsDA.GetProductByID(Convert.ToInt32(dropdownItems.SelectedValue)); MenuItemName.Text = product.ProductDetail; MenuItemID.Text = dropdownItems.SelectedValue; Price.Text = product.ProductPrice.ToString(); PriceTable.Visible = true; }