protected void Button1_Click(object sender, EventArgs e) { MealOrder meal = new MealOrder(); foreach (ListItem item in CBLEntree.Items) { if (item.Selected) { meal.AddEntree(item.Text); } }//end of foreach foreach (ListItem item in CBLDrinks.Items) { if (item.Selected) { meal.AddDrink(item.Text); } }//end of foreach Session["Meal"] = meal; Response.Redirect("Receipt.aspx"); }//end of button
protected void Button1_Click(object sender, EventArgs e) { //declare an instance of the mealorder MealOrder meal = new MealOrder(); //add the checked meaks to the meal list in the class foreach (ListItem item in CBLEntree.Items) { if (item.Selected) { meal.AddEntree(item.Text); } }//end of foreach //add the drinks foreach (ListItem item in CBLDrinks.Items) { if (item.Selected) { meal.AddDrink(item.Text); } }//end of foreach Session["Meal"] = meal; Response.Redirect("Receipt.aspx"); }//end of the button