我正在爲動態生成單選按鈕。 我的代碼運行的,如何爲動態生成的單選按鈕提供名稱
@{int questionCount = 0;
}
@{foreach (SectionDetail sectionDetail in section.SectionDetails)
{
<table>
<tr>
<td>
@Html.Label(sectionDetail.Title)
</td>
@{count = 0;
}
@foreach (SectionScore sectionScore in Model.IndividualSections)
{
<td class="ColSupplier">
@Html.RadioButtonFor(model => model.IndividualSections[count].SectionScores[questionCount].score.pass, true)Pass
@Html.RadioButtonFor(model => model.IndividualSections[count].SectionScores[questionCount].score.pass, false)Fail
</td>
count++;
}
</tr>
</table>
questionCount++;
}
這裏是一些單選按鈕具有相同的名稱。所以我無法得到確切的價值。如何爲這些單選按鈕提供不同的名稱。請幫我整理一下。
這可能不起作用,因爲單選按鈕分組基於名稱。綁定的模型將作爲名稱。所以相同的名字被綁定在兩行或更多行中。所以分組落在一行或多行。我需要將分組限制在一行中。 – 2012-01-19 04:18:42