I have a simple question. I'm implementing a CRUD for a n:m relationship (users / roles namely) using the SimpleMembershipProvider (which is awkward by its own nature). I created a view class:
public class AssignedRoleData
{
public string RoleName { get; set; }
public bool Assigned { get; set; }
}
I added this to my user class:
public List<AssignedRoleData> AssignedRoles { get; set; }
This is my AssignedRoleData.cshtml:
@model NfseEasyWeb.Models.AssignedRoleData
@Html.HiddenFor(model => model.RoleName)
@Html.LabelFor(model => model.Assigned, Model.RoleName)
@Html.EditorFor(model => model.Assigned)
I want them to appear on a horizontal line.
<table>
<tr>
@foreach (var item in Model.AssignedRoles) {
<td>
<div class="editor-field">
@Html.Editor What goes here?
</div>
</td>
}
</tr>
</table>
I know I could just use
@Html.EditorFor(model => model.AssignedRoles)
And the framework would detect it's a collection and render as many AssignedRoleData.cshtml as necessary, but they appear in pure form in html, vertical, I want them to appear on a horizontal line.
This is what I wanted. Did it applying CSS to the editor template, now need to work on margin.
Thanks