protected void UpdateCategory_Click(object sender, EventArgs e) { dropdownItems.Items.Clear(); string category = dropdownCategory.SelectedValue; products = ProductsDA.GetAllProducts(); foreach (Products product in products) { if (product.ProductType == category) { ListItem productItem = new ListItem(); productItem.Text = product.ProductDetail; productItem.Value = product.ProductID.ToString(); dropdownItems.Items.Add(productItem); ItemTable.Visible = true; PriceTable.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (((Employee)Session["employee"] == null) || (((Employee)Session["employee"]).EmployeeRole != "store manager")) { Response.Redirect("AdminLogin.aspx"); } products = ProductsDA.GetAllProducts(); categories = new List <string>(); foreach (Products product in products) { if (!categories.Contains(product.ProductType)) { categories.Add(product.ProductType); ListItem categoryItem = new ListItem(); categoryItem.Text = product.ProductType; categoryItem.Value = product.ProductType; dropdownCategory.Items.Add(categoryItem); } } }