我有一个foreach循环,我有一个单选按钮,如下所述。动态生成单选按钮名称?
我下面的代码:
@section Scripts {
<script type="text/javascript" src="@Url.Content("~/Scripts/ViewModel/LeadQualification.js")"></script>
}
<div style="width: 1100px; height: 700px;" class="container">
<div style="width: 1100px; height: 110px; background-color: burlywood">
<table>
<tr>
<td style="width: 400px; height: 110px; background-color: burlywood;" align="left">
<h3>Qualification Factor</h3>
</td>
<td style="width: 400px; height: 110px; background-color: burlywood" align="center">
<h3>Score</h3>
</td>
<td style="width: 400px; height: 110px; background-color: burlywood" align="center">
<h3>Comment</h3>
</td>
</tr>
</table>
</div>
<div style="width: 1100px; height: 580px; border: 1px solid; overflow-x: scroll; overflow-y: scroll;" >
<table>
<tr>
<td style="width: 200px; height: 50px;" align="center"></td>
<td style="width: 200px; height: 50px;" align="center">
<h4>Negative</h4>
</td>
<td style="width: 200px; height: 50px;" align="center">
<h4>Neutral</h4>
</td>
<td style="width: 200px; height: 50px;" align="center">
<h4>Positive</h4>
</td>
</tr>
</table>
<table>
<tbody data-bind="foreach: leadqualificlist">
<tr>
<td style="width: 250px; height: 130px;">
<h4 data-bind="text: $data.LeadQualifition"></h4>
</td>
<td style="width: 580px; height: 80px;">
<table>
<tr>
<td style="width: 210px; height: 50px;" align="center">
<h4 data-bind="text: $data.Negativescore" 0-1-2-3>
<br />
</h4>
</td>
<td style="width: 210px; height: 50px;" align="center">
<h4 data-bind="text: $data.Neutralscore" 4-5-6>
<br />
</h4>
</td>
<td style="width: 210px; height: 50px;" align="center">
<h4 data-bind="text: $data.Positivescore" 7-8-9>
<br />
</h4>
</td>
</tr>
<tr>
<td style="width: 210px; height: 50px;" align="center">
<input type="radio" style="width: 20px; height: 20px;" name="grp" value="0" data-bind="checked:Scoreschk" />
<input type="radio" style="width: 20px; height: 20px;" name="grp" value="1" data-bind="checked:Scoreschk" />
<input type="radio" style="width: 20px; height: 20px;" name="grp" value="2" data-bind="checked:Scoreschk" />
<input type="radio" style="width: 20px; height: 20px;" name="grp" value="3" data-bind="checked:Scoreschk" />
</td>
<td style="width: 210px; height: 50px;" align="center">
<input type="radio" style="width: 20px; height: 20px;" name="grp" value="4" data-bind="checked:Scoreschk" />
<input type="radio" style="width: 20px; height: 20px;" name="grp" value="5" data-bind="checked:Scoreschk" />
<input type="radio" style="width: 20px; height: 20px;" name="grp" value="6" data-bind="checked:Scoreschk" />
</td>
<td style="width: 210px; height: 50px;" align="center">
<input type="radio" style="width: 20px; height: 20px;" name="grp" value="7" data-bind="checked:Scoreschk" />
<input type="radio" style="width: 20px; height: 20px;" name="grp" value="8" data-bind="checked:Scoreschk" />
<input type="radio" style="width: 20px; height: 20px;" name="grp" value="9" data-bind="checked:Scoreschk" />
</td>
</tr>
</table>
</td>
<td>
<textarea style="width: 300px; height: 110px;" data-bind="value: $data.Commenttext">Text Box
</textarea>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%">
<tr>
<td></td>
<td></td>
<td align="center">
@*<button data-bind="click :$root.create" style="background-color:burlywood">Save</button>*@
<input type="submit" title="Save" value="Submit" data-bind="click:$root.create" style="background-color: burlywood" />
<input type="submit" title="Save" value="Next Stage" style="background-color: burlywood" />
</td>
</tr>
</table>
</div>
</div>
问题在这里我想有一个单选按钮分组基于一行。如果我有一个静态名称,即名称=“grp”,当我selet其他单选按钮的其他选择正在实现。
所以我想分配一个动态名称?在这种情况下,有没有更好的替代方案适合我。
你的努力是值得赞赏 问候
你的其他选择的意思越来越影响? – lampdev
在我上面的代码中使用复选框 –
有一个foreach循环,它将运行10次。根据我的代码,我会得到10 tr的每个TR有一些单选按钮应该被分组。我面对的问题很简单,因为我有我的所有TR的单选按钮的名称相同,当我选择其他正在生效 – user3483538