Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Posting back lists of checkboxes

$
0
0

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" />
        }


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>