Watch this example on YouTube:
To fix it replace
@model WebApplication3.Models.EmployeeList
@using (Html.BeginForm(null, null, FormMethod.Post))
{
if (Model.myEmployees != null)
{
foreach (var item in Model.myEmployees)
{
@Html.CheckBoxFor(modelItem => item.IsValid.GetValueOrDefault, new { id = item.EmployeeID })
@Html.DisplayFor(modelItem => item.FirstName)
}
}
}
with
@model WebApplication3.Models.EmployeeList
@using (Html.BeginForm(null, null, FormMethod.Post))
{
if (Model.myEmployees != null)
{
foreach (var item in Model.myEmployees)
{
@Html.CheckBoxFor(modelItem => item.IsValid.Value, new { id = item.EmployeeID })
@Html.DisplayFor(modelItem => item.FirstName)
}
}
}
No comments:
Post a Comment