private void loadDataProductSetting() { flpProdutcSetting.Controls.Clear(); int i = 1; string[] lstProduct = { "Menu List", "Group List", "Item List", "Modifier List", "Price List" }; txtSearch.Visible = false; foreach (string str in lstProduct) { UCProductSetting ucProduct = new UCProductSetting(); ucProduct.lblNameProductSetting.Text = str; ucProduct.Tag = i; ucProduct.Click += ucProduct_Click; flpProdutcSetting.Controls.Add(ucProduct); i++; } }
void ucProduct_Click(object sender, EventArgs e) { this.CurrentPage = 1; this.TotalPage = 0; UCProductSetting ucProduct = (UCProductSetting)sender; int tag = Convert.ToInt32(ucProduct.Tag); foreach (Control ctr in flpProdutcSetting.Controls) { if (ctr.BackColor == Color.FromArgb(0, 102, 204)) { ctr.BackColor = Color.FromArgb(255, 255, 255); ctr.ForeColor = Color.FromArgb(51, 51, 51); } } ucProduct.BackColor = Color.FromArgb(0, 102, 204); ucProduct.ForeColor = Color.FromArgb(255, 255, 255); pnDetail.Controls.Clear(); this.btnAdd.Enabled = true; switch (tag) { case 1: addMenuList("Search", tag); break; case 2: addGroupList("Search", tag, this.CurrentPage); break; case 3: addItemList("Search", tag, this.CurrentPage); break; case 4: addModifier("Search", tag, this.CurrentPage); break; case 5: addPriceList(tag, this.CurrentPage); break; } }