I have the code below in the cshtml file. The goal is for the user to edit the Boolean field RestrictDocumentViewForCurrentDocument which is inside of the object UsersonHearing which is a list of UsersModel. I am getting the UsersonHearing field to be populated on post through the hidden fields, but its not mapping the new boolean value to the objects. Im suspecting its part of the name field on the input, but I dont know what its suppose to be or if its possible?
@for (int i = 0; i < Model.UsersonHearing.Count; i++)
{
<tr>
<td>
@Model.UsersonHearing.ElementAtOrDefault(i).BuiltFullName
</td>
<td>
@Model.UsersonHearing.ElementAtOrDefault(i).EmailAddress
</td>
<td>
@Model.UsersonHearing.ElementAtOrDefault(i).AttorneyRole
</td>
<td>
<input name=" @Model.UsersonHearing[i].UserID" asp-for="@Model.UsersonHearing.ElementAtOrDefault(i).RestrictDocumentViewForCurrentDocument" type="checkbox" />
@Html.HiddenFor(Model => Model.UsersonHearing[i].UserID)
@Html.HiddenFor(Model => Model.UsersonHearing[i].Hearing_UsersID)
@Html.HiddenFor(Model => Model.UsersonHearing[i].BuiltFullName)
@Html.HiddenFor(Model => Model.UsersonHearing[i].RestrictDocumentViewForCurrentDocument)
</td>
</tr>
}
public List<UsersModel> UsersonHearing { get; set; } = new List<UsersModel>();
public class UsersModel
{
public string EmailAddress { get; set; }
public NameDTO Name { get; set; }
public string UserType { get; set; }
public Boolean CourtUser { get; set; }
public int UserID { get; set; }
public string AttorneyRole { get; set; }
public int AttorneyRoleID { get; set; }
public string BuiltFullName { get; set; }
public Boolean PendingCreation { get; set; }
public int? Hearing_UsersID { get; set; }
public int? Case_UsersID { get; set; }
public Boolean RestrictDocumentViewForCurrentDocument { get; set; }
}
