我有一个父视图,上面有两个部分视图。
每个部分视图都有自己的形式,我发布到。
当我提交其中一个表格时,他们都验证(服务器端)。
我该如何防止这种情况?
两个表单都设置为发布到父视图。
代码
@{Html.RenderAction("LogOn", "LogOn");}
@{Html.RenderAction("Register", "Register");}
public class SignInController : Controller
{
public ActionResult Index()
{
return this.View();
}
}
@using (Html.BeginForm("Index", "SignIn", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
[HttpPost]
public ActionResult LogOn(LogOnModel model)
{
return this.PartialView("_LogOn", model);
}
@using (Html.BeginForm("Index", "SignIn", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
[HttpPost]
public ActionResult Register(RegisterModel model)
{
return this.PartialView("_Register", model);
}