I have list of objects
AAA.aListofObjects= (from tdrc in db.objectsDB
where tdrc.objectID == id
select tdrc).ToList();
one parameter AAA.aListofObjects.check - holds true or false data.
Inside view I render my list using "for" where I have "If" statement to decide whether to check or not the checkbox
@for (int i = 0; i < Model.aListofObjects.Count; i++)
{
if(something equals something then I must render checkbox as checked)
{
@Html.CheckBoxFor(modelItem => modelItem.aListofObjects[i].check)
}
else
{
render unchecked checkbox
@Html.CheckBoxFor(modelItem => modelItem.aListofObjects[i].check)
}
}
Now how can I make them checked in this situation ? @Html.CheckBoxFor(modelItem => modelItem.aListofObjects[i].check, @checked="checked")
does not help.
Aucun commentaire:
Enregistrer un commentaire