jeudi 24 octobre 2019

Html.CheckBoxfor() in for loop does not display checkbox

Trying to iterate over a list in my view to display user preferences and if they're hecked or not.

Here is what I have for now in my view:

 @for (var i = 0; i < Model.IdentityFields.FieldDefinitions.Count(); i++)
            {
                @Html.HiddenFor(m => m.IdentityFields.FieldDefinitions[i].Id)
                @Html.CheckBoxFor(m => m.IdentityFields.FieldDefinitions[i].IsActivated)
                @Html.Raw(Model.IdentityFields.FieldDefinitions[i].Name)
                @Html.Raw(Model.IdentityFields.FieldDefinitions[i].ApiKey)
                <br/>
            }

But checkboxes are not displayed.

enter image description here

Anyone can see if I'm doing something wrong here? Thanks for helping !




Aucun commentaire:

Enregistrer un commentaire