Html.RadioButtonListFor problem
Posted
by ognjenb
on Stack Overflow
See other posts from Stack Overflow
or by ognjenb
Published on 2010-05-26T07:16:14Z
Indexed on
2010/05/26
7:21 UTC
Read the original article
Hit count: 340
c#
|asp.net-mvc
<%using (Html.BeginForm("Numbers", "Numbers", FormMethod.Post))
{ %>
<table id="numbers">
<tr>
<th>
prvi_br
</th>
<th>
drugi_br
</th>
<th>
treci_br
</th>
</tr>
<%int rb =1; %>"
<% foreach (var item in Model) { %>
<tr>
<td>
<%= Html.Encode(item.prvi_br) %>
<input type="radio" name="<%= Html.Encode(rb) %>" value="<%= Html.Encode(rb) %>" />
</td>
<td>
<%= Html.Encode(item.drugi_br) %>
<input type="radio" name="<%= Html.Encode(rb) %>" value="<%= Html.Encode(rb) %>"/>
</td>
<td>
<%= Html.Encode(item.treci_br) %>
<input type="radio" name="<%= Html.Encode(rb) %>" value="<%= Html.Encode(rb) %>"/>
</td>
</tr>
<% rb++; %>
<% } %>
</table>
<p>
<input type="submit" value="Save" />
</p>
<%} %>
How post this form with only one checked radio button? In my case all of 3 radio buttons is possible to check. How to restrict so that it is possible check only one radio. In this article I found good solutions but it can not be applied because I have a table.
© Stack Overflow or respective owner