I have 2 for loops and need to check if the model contains value based on current ones.
<% for (int currentDay = 1; currentDay <= 7; currentDay++)
{ %>
<%=Html.CheckBox("TimeRange" + currentDay.ToString())%>
<%} %>
Somehow I need to make the checkbox checked if the model contains data based on 2 parameters (i just put the first loop there)
Kida like:
<%= Html.CheckBox("TimeRange..", (bool)Model.Timetable.Contains(x => x.Time == timeval && x => x.DayOfWeek = i))%>
How is that done?
/M
I any you want
Anyrather thanContains, and your syntax is a bit off. Try this:Note that it’s just one lambda expression, so there’s only one
x =>bit, and also note the==instead of=in the second condition.