MVC 4:是否可以仅将修改后的行发布回控制器

时间:2013-09-06 13:23:19

标签: asp.net-mvc

我的项目有一个显示多行的主窗体。在下面的示例中,id =“Grid”*的div将被包含表的部分视图替换。该表单是一个Ajax表单,并且是强类型的。有没有办法只将已修改过的行发送回控制器并让模型只包含那些行?

@model Models.myModel;

@using (Ajax.BeginForm("Save", "myController", new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "AllGrids" }, new { id = "frm" }))
    { 
    <div id="AllGrids">
        <table id="EvidenceGrids" style="width: 1200px">
            <tr>
                <td style="border-style: solid; border-width: thin">
                    <div id="Grid1"></div>
                </td>
            </tr>

            <tr>
                <td style="border-style: solid; border-width: thin">
                    <div id="Grid2"></div>
                </td>
            </tr>

            <tr>
                <td style="border-style: solid; border-width: thin">
                    <div id="Grid3"></div>
                </td>
            </tr>

        </table>
    </div>
    }

    public ActionResult Save (Model m)
    {
        use model as needed
    }

0 个答案:

没有答案