protected void addIngredient_Click(object sender, EventArgs e) { count++; for (int j = 2; j < count; j++) { string uControl = "ucIngredient" + j; ucIngredient uc = (ucIngredient)PlaceHolder1.FindControl(uControl); uc.Visible = true; } }
private void AddIngredientToRecipe(Recipe aRecipe) { for (int i = 1; i < 16; i++) { ucIngredient uc = (ucIngredient)PlaceHolder1.FindControl("ucIngredient" + i); if (uc != null && uc.Visible == true) { PlaceHolder1.Controls.Add(uc); var ing = new Ingredient(); ing.Name = uc.NameOfIngredient; ing.Quantity = uc.Qty; ing.UnitOfMeasure = uc.Unit; //lblResult.Text += " "+ing.Name + " " + ing.Quantity + " " + ing.UnitOfMeasure+" "; aRecipe.Needs[i - 1] = ing; } } }