I'm not a seasoned front-end developer, so I'm struggling with this simple issue...
I have a model related to my database which is a list of 'things'. On my View, I add a checkbox for each row in the list. For every item checked, I want to add a row to an associative table. ...Pretty simple/standard logic. I've designed my checkbox names so I know what id's I'm dealing with, so that isn't my problem. What I'm struggling with is how to get visibility to the checkboxes in my controller. Simply put--what/how can I pass back these checkboxes to the controller so I can loop through them there and call my stored procedure to insert the rows?
Adding my code, but I don't think my issue is just about syntax--I'm not understanding how I actually send the list back to a controller method. I don't want to add it to my model, which is the result of a stored procedure call to get the reference information of the things I want to add. To modify that model would be to put in front-end "stuff" (what the user selected), which is irrelevant to my model which is a list of all related items--I only want a list of the id's of the ones that we want to relate in our associative table. I think I'm looking for a javascript, jquery or json that will generate the list for me so then I could send it to the controller when the "Save and Continue" button is clicked--that is the part I don't know how to do.
@model PagedList.IPagedList<LMN.Models.GetRelatedEquipmentByEquipmentItemCategory_Result>
@using PagedList.Mvc;
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
@{
    ViewBag.Title = "GetRelatedEquipment";
}
<h2>GetRelatedEquipment</h2>
@*@{var EquipmentItemCategoryId = ViewContext.RouteData.Values["EquipmentItemCategoryId"].ToString(); }*@
<table>
    <tr>
        <th>
                Select
            </th>
        <th>
            @Html.DisplayNameFor(model => model.FirstOrDefault().RelatedCategory)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.FirstOrDefault().GroupName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.FirstOrDefault().MedicareCoverageLikely)
        </th>
    </tr>
    @{ var i = 0; }
    @foreach (var item in Model)
    {
        <tr>
            <td class="border">
                @Html.CheckBox("selectedObjects" + item.RelatedCategoryId)
                    @*@Html.CheckBox("selectedObjects" + item.RelatedCategoryId, new { value = "selectedObjects" + item.RelatedCategoryId })*@
                    @*@Html.Hidden("check[" + i.ToString() + "].RelatedCategoryId", item.RelatedCategoryId)*@
            </td>
            <td class="border">
                @Html.DisplayFor(modelItem => item.RelatedCategory)
            </td>
            <td class="border">
                @Html.DisplayFor(modelItem => item.GroupName)
            </td>
            <td class="border">
                @Html.DisplayFor(modelItem => item.MedicareCoverageLikely, true)
            </td>
                @Html.HiddenFor(modelItem => item.RelatedCategoryId)
        </tr>
        i++;
    }
</table>
<table>
    <tr>
        <td>
            @*@using (Html.BeginForm("GetRelatedSeatSupport", "Letter", new { model => model.FirstOrDefault().EquipmentItemCategoryId = 5 }))
            {*@
            @using (Html.BeginForm("TryThis", "Letter"))
            {
                <p>
                    <input type="submit" value="Save and Continue" />
                </p>
            }
            @*@Html.ActionLink("Save and Continue", "GetRelatedSeatSupport", new { EquipmentItemCategoryId = 7 })*@
        </td>
    </tr>
</table>
 
    