I'm following this answer here, with this code:
SomeControl.cshtml
@model Econo.WebUI.ViewModel.UserRoleViewModel
@Html.HiddenFor(x => Model.UserId)
@Html.EditorFor(x => Model.Roles)
/Shared/EditorTemplates/Roles.cshtml
@model Econo.WebUI.ViewModel.RoleViewModel
@Html.EditorFor(m => m.IsInRole)
@Html.EditorFor(m => m.RoleId)
@Html.EditorFor(m => m.RoleName)
For some reason, this only output:
<input id="UserId" type="hidden" value="1LS82" name="UserId">
FalseFalse
The FalseFalse shows that there are 2 roles in the database and the user is in none of them, which is correct. But I need a checkbox with the ID and Name. Also being able to submit this back to the server to add roles to user.