private void cbxdanhmuc_SelectedIndexChanged(object sender, EventArgs e) { int id = 0; ComboBox cb = sender as ComboBox; if (cb.SelectedItem == null) { return; } cTypeFood select = cb.SelectedItem as cTypeFood; id = select.IDType; LoadFood(id); }
public List <cTypeFood> GetListTypeFood() { List <cTypeFood> lstype = new List <cTypeFood>(); string query = "EXEC GetListFoodType"; DataSet ds = db.ExecuteQueryDS(query, CommandType.Text); DataTable dt = new DataTable(); dt = ds.Tables[0]; foreach (DataRow item in dt.Rows) { cTypeFood type = new cTypeFood(item); lstype.Add(type); } return(lstype); }