您可以通過AJAX發佈數據。 在我的例子中,我使用jQuery:
<div id="first-form" class="form-container">
@Html.Partial("FirstPartial")
</div>
<div id="second-form" class="form-container">
@Html.Partial("SecondPartial")
</div>
// and here go rest forms
你的局部視圖,可以執行以下操作:
@model YourModelClass
@using (Html.BeginForm())
{
// some fields go there
}
<input type="button" value="Save Form Data" class="save-button"/>
的js將以下內容:
$("input.save-button").on("click", function() {
var button = $(this);
var container = button.closest("div.form-container");
var url = container.find("form").attr("action");
container.busy($.post(url, function (response) {
container.html(response);
}));
return false;
});
感謝pstarkov,正是我一直在尋找。 – DotNetDeveloper 2012-04-10 15:12:50