Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Html.CheckBox is doing something weird - if you view source on the resulting page, you'll see there's an <code>&lt;input type="hidden" /&gt;</code> being generated alongside each checkbox, which explains the "true false" values you're seeing for each form element.</p> <p>Try this, which definitely works on ASP.NET MVC Beta because I've just tried it.</p> <p>Put this in the view instead of using Html.CheckBox():</p> <pre><code>&lt;% using (Html.BeginForm("ShowData", "Home")) { %&gt; &lt;% foreach (var o in ViewData.Model) { %&gt; &lt;input type="checkbox" name="selectedObjects" value="&lt;%=o.Id%&gt;"&gt; &lt;%= o.Name %&gt; &lt;%}%&gt; &lt;input type="submit" value="Submit" /&gt; &lt;%}%&gt; </code></pre> <p>Your checkboxes are all called <code>selectedObjects</code>, and the <code>value</code> of each checkbox is the GUID of the corresponding object.</p> <p>Then post to the following controller action (or something similar that does something useful instead of Response.Write())</p> <pre><code>public ActionResult ShowData(Guid[] selectedObjects) { foreach (Guid guid in selectedObjects) { Response.Write(guid.ToString()); } Response.End(); return (new EmptyResult()); } </code></pre> <p>This example will just write the GUIDs of the boxes you checked; ASP.NET MVC maps the GUID values of the selected checkboxes into the <code>Guid[] selectedObjects</code> parameter for you, and even parses the strings from the Request.Form collection into instantied GUID objects, which I think is rather nice.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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