Reputation: 337
I am trying to re define the select query and make it user defined by first listing out all the fields in one checkbox list and grouping them in another and providing a where condition for selected check boxed fields. I am returning a view model that contains the list of all my columns. I need to know how to populate the list from my view model onto a asp.net checkbox list.
Thanks in advance, Hrg
Upvotes: 0
Views: 505
Reputation: 501
You van use this also
@for (int i = 0; i < Model.PropertyName.Count(); i++) {
@Html.CheckBoxFor(model => Model.Tags[i])
}
Upvotes: 1
Reputation: 15387
As per my understanding try this
@for (int i = 0; i < Model.PropertyName.Count(); i++)
{
<p>
@Html.CheckBox("model.PropertyName[" + i + "]", !Model.PropertyName[i])
</p>
}
Upvotes: 1