0

我决定用 Areas 组织我的应用程序,现在有些表单无法提交。

控制器

public class SoftwareInfoController{
    public ActionResult Index(){...}
    public ActionResult New(){...}
    [HttpPost]
     public ActionResult Save(SoftwareInfoViewModel viewModel){...}
}

我可以像这样访问视图,“包装”是一个区域

webpage.com/Packaging/SoftwareInfo/Index
webpage.com/Packaging/SoftwareInfo/New

Index 和 New 方法都可以正常工作。但我无法提交表格。

edit.cshtml
@model SoftwareInfoViewModel 
...
@using (Html.BeginForm("Save","SoftwareInfo")){...} // does nothing
@using (Html.BeginForm("Save","SoftwareInfo", FormMethod.Post)){...} // does nothing
@using (Html.BeginForm("Save","SoftwareInfo", new {Area = "Packaging" })) {...}// does nothing

路由

    context.MapRoute(
    name: "Packaging_default",
    url: "Packaging/{controller}/{action}/{id}",
    defaults: new { controller = "Editor", action = "Index", id  =UrlParameter.Optional },
    namespaces: new[] { "WebApp.Areas.Packaging.Controllers" }
    );
4

1 回答 1

0

解决了,

如果有人遇到此问题,请确保模型中的 Remote 属性方法链接没有损坏!

于 2015-06-18T15:46:58.283 回答