I'm new to asp.net mvc 4 and I'm stuck at displaying radiobuttons for the items in my model. I'm using asp.net identity 2 for user authentication and roles assignments. I want to display the roles as radio buttons so that the admin has the option to set the role for each user. The radio button appears but on clicking the save/submit button the role of the user is not saved in the database.
Below is my view:
<div class="form-group">
@Html.Label("Roles", new { @class = "control-label col-md-2" })
<span class=" col-md-10">
@foreach (var item in Model.RolesList)
{
@Html.RadioButtonFor(m => m.RolesList, new { @class = "radio-inline",id="role"+item.Value})
@Html.Label(item.Value, new { @class = "control-label" })
}
</span>
</div>
Please guide me through this. Thank you. I have also attached an image of how it appears.I don't understand why there's X and Y appearing next to the label.