What I have : A C# database query that returns two columns, one of which contains a start time of a meeting, the other of which contains the end time. The times are of the same time period and cannot be over two days.
What I would like to do : Cycle through these returned values, and create a dropdown box for each day containing the start-corresponding end time. If there are no values for a certain day, display the message “No times free for this day”.
My code so far :
var result = db.Query(//returns two columns, ds and de, two dateTimes meaning the start and end date of an event.)
<form id="form" name="form" method="post" action="insert.cshtml">
<label>@result.First().ds.DayOfWeek <select name="start_to_end_time"></label>
@foreach(var record in result) {
if(day.Equals(record.ds.DayOfWeek)) {
<option value="@record.ds">@record.ds.ToString("HH:mm") - @record.de.ToString("HH:mm")</option>
} else {
</select>
<label>@record.ds.DayOfWeek<select name="start_to_end_time"></label>
<option value=@record.ds>@record.ds.ToString("HH:mm") - @record.ds.ToString("HH:mm")</option>
}
}
This throws the error : “Encountered end tag “select” with no matching start tag. Are your start/end tags properly balanced?”
However, looking at my code, I believe they are balanced correctly? Can anybody help me with this please?
You have the equivalent of this which is invalid markup: