Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to perform a simple multiple selection in a table ASP.NET MVC4
    text
    copied!<p>Here is what my view looks like:</p> <pre><code>@model Affiliate &lt;div class="box paint color_16"&gt; &lt;div class="title"&gt; &lt;h4&gt;&lt;i class="icon-tasks"&gt;&lt;/i&gt;&lt;span&gt;@Model.CompanyName's Commissions&lt;/span&gt; &lt;/h4&gt; &lt;/div&gt; &lt;div class="content top "&gt; &lt;div class="subtitle"&gt; @Html.ActionLink("Void", "DeleteInvoice", new { commList = "??", affId = Model.Id }, new { @class = "btn" }) @Html.ActionLink("Create Invoice", "CreateInvoice", new { commList = "??", affId = Model.Id }, new { @class = "btn" }) @Html.ActionLink("Pay", "PayInvoice", new { commList = "??", affId = Model.Id }, new { @class = "btn" }) &lt;/div&gt; &lt;table class="table table-striped table-hover"&gt; &lt;tr&gt; &lt;h3&gt;Commissions&lt;/h3&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;Amount&lt;/td&gt; &lt;td&gt;Status&lt;/td&gt; &lt;td&gt;Action&lt;/td&gt; &lt;/tr&gt; @foreach (var item in Model.Commissions) { &lt;tr&gt; @if (item.Status == ViewBag.PaymentStatus || ViewBag.PaymentStatus == "All") { &lt;td&gt;@Html.CheckBox("commId", new { value = item.Id })&lt;/td&gt; &lt;td&gt;@Html.DisplayFor(x =&gt; item.PayoutAmount)&lt;/td&gt; &lt;td&gt;@Html.DisplayFor(x =&gt; item.Status)&lt;/td&gt; } &lt;/tr&gt; } &lt;/table&gt; &lt;/div&gt; </code></pre> <p></p> <p>What I want to be able to do is when I hit an actionlink on the top, grab all the items from the table that are checked, and pass that list of id's to the controller logic. I am assuming a viewmodel may be the solution, something like this:</p> <pre><code> public Affiliate affilite { get; set; } public List&lt;int&gt; selectedItems { get; set; } etc. </code></pre> <p>But how to I get the selected Items into that VM selectedItems container?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload