Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You are halfway right in order to post your data that the controller can read the info it must be inside a form as so :</p> <pre><code> &lt;% using(Html.BeginForm("Retrieve", "Home")) %&gt;//Retrieve is the name of the action while Home is the name of the controller &lt;% { %&gt; &lt;%foreach (var app in newApps) { %&gt; &lt;tr&gt; &lt;td&gt;&lt;%=Html.CheckBox(""+app.ApplicationId )%&gt;&lt;/td&gt; &lt;td&gt;&lt;%=Html.Encode(app.ApplicationName)%&gt;&lt;/td&gt; &lt;td&gt;&lt;%=Html.DropDownList("AppRole", new SelectList(app.Roles, "RoleId", "RoleDescription"))%&gt;&lt;/td&gt; &lt;/tr&gt; &lt;%} %&gt; &lt;input type"submit"/&gt; &lt;% } %&gt; </code></pre> <p>and on your controller :</p> <pre><code> public ActionResult Retrieve() { //since all variables are dynamically bound you must load your DB into strings in a for loop as so: List&lt;app&gt;=newApps; for(int i=0; i&lt;app.Count;i++) { var checkobx=Request.Form[""+app[i].ApplicationId]; // the reason you check for false because the Html checkbox helper does some kind of freaky thing for value true: it makes the string read "true, false" if(checkbox!="false") { //etc...almost same for other parameters you want that are in thr form } } //of course return your view return View("Index");//this vaires by the name of your view ex: if Index.aspx } </code></pre> <p>This site gives more details on how to handle the dropdownlist helper: </p> <p><a href="http://quickstarts.asp.net/previews/mvc/mvc_HowToRenderFormUsingHtmlHelpers.htm" rel="nofollow noreferrer">http://quickstarts.asp.net/previews/mvc/mvc_HowToRenderFormUsingHtmlHelpers.htm</a></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