Pass lists of selected relevant hidden field values form to the controller

Can anyone please tell me how do I pass lists of selected relevant hidden field values from to controller. The assigned field return value is Boolean(true). There are over 100 list items. If admin person select(Assigned) list and submit, it’ll pass all list values pass to the controller and update database.

This my view page chtml code:

@using (Html.BeginForm("CAssigned", "Orders", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @foreach (var item in Model)
    {
        @Html.HiddenFor(model => item.LocationId)
        <td>
            @Html.DisplayFor(modelItem => item.MapIcons)
            @Html.HiddenFor(model => item.MapIcons,"MapIcons")
        </td>
        <td>
            @Html.EditorFor(modelItem => item.Assigned)
            @Html.HiddenFor(model => item.Assigned)
        </td>
    }
    <input type="Submit" value="Select" />
}

My controller

   [HttpGet]
    public ActionResult CAssigned()
    {
        var orders = db.Locations.ToList();
        return View(orders);
    }

    [HttpPost]
   public ActionResult CAssigned(IEnumerable<Location>)
    {
    return View();
    }

html view source

<input data-val="true" data-val-number="The field LocationId must be a number." data-val-required="The LocationId field is required." id="item_LocationId" name="item.LocationId" type="hidden" value="1" />
<td>
    red-dot.png
    <input Length="8" id="item_MapIcons" name="item.MapIcons" type="hidden" value="red-dot.png" /></td>
<td>
<input class="check-box" data-val="true" data-val-required="The Assigned to Courier field is required." id="item_Assigned" name="item.Assigned" type="checkbox" value="true" /><input name="item.Assigned" type="hidden" value="false" />
<input type="Submit" value="Select" />
<input id="item_Assigned" name="item.Assigned" type="hidden" value="False" />
<td>


Download pass.lists.of.selected.relevant.hidden.field.values.form.to.the.controller.zip
Direct Link


Download


Download pass.lists.of.selected.relevant.hidden.field.values.form.to.the.controller.zip
Mediafire


Download


Download pass.lists.of.selected.relevant.hidden.field.values.form.to.the.controller.zip
Letitbit


Download


Download pass.lists.of.selected.relevant.hidden.field.values.form.to.the.controller.zip
DropBox


Download


Download pass.lists.of.selected.relevant.hidden.field.values.form.to.the.controller.zip
Filevice


Download

Both comments and pings are currently closed.

Comments are closed.