来自MVC中单个表单的多个局部视图的单个发布请求

时间:2016-01-25 17:42:13

标签: c# ajax model-view-controller

在MVC表单中,三个选项卡是个人,地址,联系人,每个表单都有自己的局部视图,可以在选项卡上单击。 以下是我的表单的HTML

<ul id="divTabs" class="nav nav-tabs nav-justified">
<li role="presentation" class="active">
@Ajax.ActionLink("Personal", "Personal", "ProfileManage", new AjaxOptions()
{
       HttpMethod = "Post",
       UpdateTargetId = "divTabsContent",
       InsertionMode = InsertionMode.Replace
})
</li>
<li role="presentation">
@Ajax.ActionLink("Address", "Address", "ProfileManage", new AjaxOptions()
{
       HttpMethod = "Post",
       UpdateTargetId = "divTabsContent",
       InsertionMode = InsertionMode.Replace
})
</li>
<li role="presentation">
@Ajax.ActionLink("Contact", "Contact", "ProfileManage", new AjaxOptions()
{
       HttpMethod = "POST",
       UpdateTargetId = "divTabsContent",
       InsertionMode = InsertionMode.Replace
})
</li>
</ul>
@using (Ajax.BeginForm("AjaxPost", "ProfileManage", new AjaxOptions()
{

    HttpMethod = "POST",
    UpdateTargetId = "divTabsContent",
    InsertionMode = InsertionMode.Replace
}))
{   
 <div id="divTabsContent" class="tab-content tab-pane bordered">
   @Html.Partial("~/Views/ProfileManage/_DetailPersonal.cshtml", Model);
 </div>
}

在每个局部视图(个人,地址,联系人)内都有提交按钮 那么我如何区分发布请求是来自控制器发布请求中的哪个部分视图。

0 个答案:

没有答案