I must admit I am new to C# MVC 4 programming, but I've never seen such a weird thing in any other programming language...
The if part inside the foreach works good, however, even if it's true, the else part gets executed, which is very strange.
When I remove " @dag.Datum.ToString("dd/MM/yyyy") ", the if else works, but unfortunately that is not what I want.
Thanks in advance for any help!
(ow and sorry for the dutch I used in my code)
@using (Html.BeginForm())
{
<br /><br /><table>
@foreach (var cursist in Model.Cursisten.Where(cursist => cursist.Soort == 1))
{
<tr>
<th>@cursist.Email</th>
@foreach (var dag in Model.Opleidingsdagen.Where(m => m.chked == true))
{
<td>
@foreach (var afw in Model.Afwezigheden)
{
if (afw.DagID.Equals(dag.DagID) && afw.CursistID.Equals(cursist.Email))
{
@:a @dag.Datum.ToString("dd/MM/yyyy")
}
else
{
@:b
}
}
</td>
}
</tr>
}
<tr>
<td><br /><br /><input type="submit" value="Afwezigheden aanpassen" class="btn" /></td>
</tr>
</table>
}
EDIT and this is the html table output I always get:
[email protected] a 14/08/2013 b b a 15/08/2013 b b
[email protected] b b b b b b
[email protected] b b b b b b
EDIT #2 my expected output is:
[email protected] a 14/08/2013 a 15/08/2013 b
[email protected] b b b
[email protected] b b b
so there always is a 'b', even when an 'a + date ' is outputted
@:aand@:breally part of your syntax?