Asp.net mvc MVC Html.begin使用区域
我正在使用MVC区域,在一个名为“Test”的区域中的视图上,我希望有一个表单发布到以下方法:Asp.net mvc MVC Html.begin使用区域,asp.net-mvc,html-helper,Asp.net Mvc,Html Helper,我正在使用MVC区域,在一个名为“Test”的区域中的视图上,我希望有一个表单发布到以下方法: area: Security controller: AccountController method: logon 如何使用Html.BeginForm实现这一点?可以这样做吗?尝试将区域、控制器和操作指定为RouteValue @using (Html.BeginForm( new { area = "security", controller = "account", action = "lo
area: Security
controller: AccountController
method: logon
如何使用Html.BeginForm实现这一点?可以这样做吗?尝试将区域、控制器和操作指定为RouteValue
@using (Html.BeginForm( new { area = "security", controller = "account", action = "logon" } ))
{
...
}
试试这个:
Html.BeginForm("logon", "Account", new {area="Security"})
对于那些想知道如何使用默认mvc4模板的人
@using (Html.BeginForm("LogOff", "Account", new { area = ""}, FormMethod.Post, new { id = "logoutForm" }))
此选项用于具有HTML属性的区域
@using (Html.BeginForm(
"Course",
"Assign",
new { area = "School" },
FormMethod.Get,
new { @class = "form_section", id = "form_course" }))
{
...
}
@使用(Html.BeginForm(“,”,FormMethod.Post,new{id=“logoutForm”,action=“/Account/LogOff”}))
{@Html.AntiForgeryToken()
}
对于Ajax,我们可以使用
Ajax.BeginForm("IndexSearch", "Upload", new { area = "CapacityPlan" }, new AjaxOptions { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = updateTarget }, new { id = "search-form", role = "search" })
+1用于使用“area”的其他匿名类型,而不是像我尝试的那样,将“area”添加到使用“id”的匿名类型。
Ajax.BeginForm("IndexSearch", "Upload", new { area = "CapacityPlan" }, new AjaxOptions { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = updateTarget }, new { id = "search-form", role = "search" })