I have the following in MVC:
Area of Impact:
@for (int i = 0; i < Model.ImpactAreas.Count; i++)
{
@Html.HiddenFor(m => m.ImpactAreas[i].ImpactAreaID)
@Html.HiddenFor(m => m.ImpactAreas[i].Name)
@Html.HiddenFor(m => m.ImpactAreas[i].Description)
@Html.HiddenFor(m => m.ImpactAreas[i].IsActive)
@Html.HiddenFor(m => m.ImpactAreas[i].ConcurrencyDateTime)
@Html.HiddenFor(m => m.ImpactAreas[i].InsertedDateTime)
@Html.HiddenFor(m => m.ImpactAreas[i].Checked)
}
@foreach (var area in Model.ImpactAreas)
{
CurrentImpactArea = area.Name;
string myImpactAreaName = "ImpactArea" + CurrentImpactArea;
<div class="columns large-2 medium-3 small-4">
<input type="checkbox" @area.Checked name="@myImpactAreaName" value="@area.ImpactAreaID" @(area.ImpactAreaID == Model.ImpactAreaID ? " checked='checked'" : "") /><label title="@area.Description" for="ImpactAreaID">@area.Name</label>
</div>
}
</div>
I am trying to get the checkbox to set the value in the list item with the checkbox checked status (true/false) in the impact area object:
public bool Checked { get; set; }
however in my main object, I have a list of the above object
Any help?
Aucun commentaire:
Enregistrer un commentaire