0

I have a table that is holding entries from a database inside the table a user can click on any of the entries and be able to edit them. However, my controller doesn't receive the changes. I have tried to save the values onchange to a hidden input but that didn't return anything, but an empty string.

@using (Html.BeginForm()){
    <table>
        @foreach (var item in Model.LoginSecurityRecords)
                    {
                        <tr id="@item.SecurityKey">
                            <td class="displayrow1">
                                <span class="display-mode" name="NewUserID" onchange="document.getElementById('ChangeID').value = this.value">
                                    @item.UserID
                                </span><br /><br /><br /><br />
                                <input name="ChangeID" id="ChangeID" type="hidden"/>
                            </td>
                            <td>
                                <button type="submit" data-id="{{@item.SecurityKey->id}}" name="Save" id="save" class="btn btn-primary save" value="@item.SecurityKey" onclick="AdminEditing();" formaction="@Url.Action("Edit")">Save Changes</button>
                            </td>
                        </tr>
    }
    </table>
}

My controller is returning an empty string for this:

string userId = Request.Form["ChangeID"];

Any help or advice would be greatly appreciated.

0 Answers0