private void LoadProductInfoByCatId(int p, TreeNodeCollection tnc) { ProductInfoBLL bll = new ProductInfoBLL(); List<ProductInfo> list = bll.GetProductInfoByCatId(p); for(int i=0; i<list.Count; i++) { tnc.Add(list[i].ProName + "====="+list[i].ProPrice+"元"); } }
private void cmbCategory_SelectedIndexChanged(object sender, EventArgs e) { if(cmbCategory.SelectedIndex !=0) { int id = Convert.ToInt32(cmbCategory.SelectedValue); ProductInfoBLL bll = new ProductInfoBLL(); dgvProductInfo.AutoGenerateColumns = false; dgvProductInfo.DataSource = bll.GetProductInfoByCatId(id); if(dgvProductInfo.SelectedRows.Count>0) { dgvProductInfo.SelectedRows[0].Selected = false; } } else { LoadProductInfoByDelFlag(0); } }