Hello
I have this loop that renders a schedule with checkboxes for each entry like this:
Monday Tuesday.....
08:00-09:00 [ ] [ ]...
10:00-11:00 [ ] [ ]...
Using this code in my view:
<% for (int i = 1; i < 10; i++)
{%>
<tr>
<td>
xx:00 - xx:00
</td>
<% for (int currentDay = 1; currentDay <= 7; currentDay++)
{ %>
<td>
<%=Html.CheckBox("TimeRange" + currentDay.ToString()) %>
</td>
<%} %>
</tr>
<% } %>
Now I need to check if, for example, 08:00 Tuesday exists in Model.Timetable, i.e DayOfWeek = 2 And StartTime = '08:00'.
So I need:
1) Check if current value exists in Model.Timetable 2) Set it to checked in that case 3) Set the value of the checkbox to Model.Timetable.StartTime
How is that done?
/M