MVC如何通过Html.ActionLink将更新的模型传递回控制器

时间:2015-04-02 19:24:57

标签: javascript asp.net-mvc forms razor html.actionlink

所以我在MVC4中有以下视图:

@model ViewModel

@section Sidebar
{
    <ul style="margin-left:-20px">
        ...
        <li>
           @Html.ActionLink(@menuItem.Name, @menuItem.ActionName, @menuItem.ControllerName, @Model, new { id = @menuItem.Name + "MenuItemId", style = "font-weight: bold;", @class = "loading" })
        </li>
        ...
    </ul>
}

@using (Html.BeginForm())
{
    <article class="widget widgetFullPage" data-role="collapsible" data-collapsed="true">
        <h2 id="Details">GENERAL INFORMATION</h2>
        <table>
            <tr id="Row1" style="background-color: #FFFFFF;">
                <td id="VarOneId" style="padding-bottom: 10px; padding-top: 20px; width: 300px">
                    @Html.TextBoxFor(x => x.VarOne, null, new { style = "width:100px;" })
                </td>
            </tr>
            ...
            ...
            ...
            <tr id="RowX">
                <td>
                    <input value=" " class="nextbutton loading" type="submit" id="NextButton" />
                </td>
            </tr>
        </table>
    </article>
}

表单中的“提交”按钮工作得很好,但我还希望通过Html.ActionLink将更新的模型(无论用户已经键入的内容)传递给上面补充工具栏部分中的其他控制器,当用户点击时侧边栏链接而不是提交按钮。

我所看到的只是将模型传递给最初传递给View的数据,而不是页面中的更新值。我需要做什么才能获得更新的模型并将其传回ActionLink?

0 个答案:

没有答案
相关问题