My model is IEnumerable<> of RatingSource.
public class RatingSource
{
public int Id;
public string Source;
public bool IsActive;
In the view I want to see 2 columns: Source and radioButton, cheked if IsActive is true. I write:
@foreach (var ratingSource in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => ratingSource.Source) @Html.RadioButton("Active",ratingSource.IsActive) <br />
</td>
</tr>
}
But radioButtons are always unchecked. Where is a mistake?
have you tried:
You could also try
EDIT:
This works, however, since radiobuttons are mutually exclusive, the last 1 that is active will be the one checked.