Hey everyone,
I have this view, with my postbutton i postback a list of checkbox items:
Now I want to change this that everytime a user checks or unchecks a checkbox all the lists of checkboxes are posted back to the controller. (like standard webshop filtering)
Does anyone know how I can do this? I need to postback these lists: x[i].PostedTerms.TermIds
This is my view:
@using (Html.BeginFormAntiForgeryPost(Url.Action("Index", "Assortiment", FormMethod.Post)))
{
@Html.ValidationSummary(true)
for (var i = 0; i < Model.Count; i++)
{
@Html.HiddenFor(x => x[i].PostedTerms.TermIds);
@Html.CheckBoxListFor(
x => x[i].PostedTerms.TermIds,
x => x[i].AvailableTerms,
term => term.Id,
term => term.Name,
x => x[i].SelectedTerms,
Position.Vertical);
}
<input class="green" type="submit"
value="POST to Controller" />
}