@model IEnumerable<FacetValue>
<ul>
@foreach (var association in Model)
{
<li>
**@Html.CheckBox("association",association.IsSelected) @Html.Label("association", association.Text)**
@if (association.IsSelected == true)
{
<input type="checkbox" id="association" class="left" value="@association.Text" checked="checked"/>
}
else
{
<input type="checkbox" id="association" class="left" value="@association.Text"/>
}
<label>@association.Text</label>
</li>
}
</ul>
I am using the code that starts with @if vs the @htmlCheckBox. 1. The layout is messed up 2. It doesn't display is messed up and displays check box in one place and text in another place. 3. a hidden value is generated for every check box.
Now the question is how can I display the the contents how I want without the @if else logic.