private void LoadSanPham() { var listMatHang = db.MATHANGs.OrderBy(p => p.LOAISP).ToList(); panelMatHang.Controls.Clear(); foreach (var item in listMatHang) { ucMatHang uc = new ucMatHang(item, LuaChon); if (Helper.TenSanPham(item).ToUpper().Contains(txtTimKiem.Text.ToUpper())) { uc.Tag = item.ID; uc.Enabled = true; panelMatHang.Controls.Add(uc); } } }
private void LuaChon(object sender, EventArgs e) { ucMatHang sp = sender as ucMatHang; this.Close(); }