我有以下代码,我希望有一个内部foreach循环,但代码不会通过添加内部循环进行编译。任何帮助将不胜感激。
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>
}
}
答案 0 :(得分:6)
@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>
}
}