list = new List
在 确定 按钮的Click事件中这样写:
var item = tree1.SelectNode.Text;
if(list.FirstOrDefault(x=>x == item.Text) == null)
list.Add(item.Text);
dataGridView1.DataSource = list;
定义个全局变量List
Model model=new Model();
model.code=4;//菜品编号
model.FoodName="菜品名称";
model.Price=20;
model.FoodNum=1;
model.TotalPrice=20;
modelList.Add(model);
dataGridView.DataSource=modelList;
dataGridView.DataBind();