Reputation: 284
I have the following code in which I would like to have an inner foreach loop, but the code doesn't compile with the addition of the inner loop. Any help would be greatly appreciated.
foreach (var answer in q.Answers)
{
<input type="checkbox" name="AnswerDetails" value="@answer.AnswerText" data-answerid="@answer.Id">@answer.AnswerText<br />
foreach (var research in @answer.ResearchSet)
{
@:<p>@research.Image</p>
}
}
Upvotes: 6
Views: 4843
Reputation: 236278
@foreach (var answer in q.Answers)
{
<input type="checkbox" name="AnswerDetails" value="@answer.AnswerText" data-answerid="@answer.Id" />@answer.AnswerText<br />
foreach (var research in answer.ResearchSet)
{
<p>@research.Image</p>
}
}
Upvotes: 5