protected void rptCourseTypes_ItemDataBound(object sender, RepeaterItemEventArgs e) { RepeaterItem rptItem = e.Item as RepeaterItem; HtmlTableCell cell = rptItem.FindControl("mealTypeCell") as HtmlTableCell; HtmlTableCell parentCell = rptItem.Parent.Parent as HtmlTableCell; object courseTypeItem = rptItem.DataItem; int courseTypeId = (rptItem.DataItem as SRL_CourseType).CourseTypeId; SRL_Meal meal = this.MealsList.SingleOrDefault(ml => ml.CourseTypeId == courseTypeId); if (meal != null) { Repeater rpt = cell.FindControl("rptMealRecipes") as Repeater; if (rpt != null) { rpt.DataSource = meal.MealRecipes; rpt.DataBind(); } } }
protected void rptMealTypes_ItemDataBound(object sender, RepeaterItemEventArgs e) { RepeaterItem rptItem = e.Item as RepeaterItem; HtmlTableCell cell = rptItem.FindControl("mealTypeCell") as HtmlTableCell; HtmlTableCell parentCell = rptItem.Parent.Parent as HtmlTableCell; HiddenField hidDayIndex = parentCell.FindControl("hidDayIndex") as HiddenField; object mealTypeItem = rptItem.DataItem; int mealTypeId = (rptItem.DataItem as SRL_MealType).MealTypeId; if (hidDayIndex.Value != "") { int dayIndex = int.Parse(hidDayIndex.Value) + 7 * CurrentWeek; cell.Attributes["dayIndex"] = dayIndex.ToString(); SRL_Meal meal = this.MealsList.SingleOrDefault(ml => ml.DayIndex == dayIndex && ml.MealTypeId == mealTypeId); if (meal != null) { Repeater rpt = cell.FindControl("rptMealRecipes") as Repeater; if (rpt != null) { rpt.DataSource = meal.MealRecipes; rpt.DataBind(); } } //cell = rptItem.FindControl("dinersCell") as HtmlTableCell; //TextBox txtDiners = cell.FindControl("txtDiners") as TextBox; //if (meal != null) //{ // txtDiners.Text = meal.Diners.ToString(); //} //txtDiners.Attributes["OnChange"] = string.Format("DinersChange(this,{0},{1},{2})", this.MenuId, dayIndex, mealTypeId); } }