【问题标题】:Locate view fails when using areas使用区域时定位视图失败
【发布时间】:2011-01-14 18:02:49
【问题描述】:

我的项目中有一个区域,但视图引擎无法找到我的视图,它不在我的区域目录中查找视图?

未找到视图“索引”或其主视图,或者没有视图引擎支持搜索到的位置。搜索了以下位置: ~/Views/foo/Index.aspx ~/Views/foo/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx ~/Views/foo/Index.cshtml ~/Views/foo/Index.vbhtml ~/Views/Shared/Index.cshtml ~/Views/Shared/Index.vbhtml

【问题讨论】:

    标签: asp.net asp.net-mvc-3


    【解决方案1】:

    您必须在创建 ActionLink 时指定要使用的区域,并且如果您要在该区域之外注册路线。

    <%=Html.ActionLink("Test", "Action", "Controller", new { area = "MyArea" }, null) %>
    

    【讨论】:

      猜你喜欢
      • 2013-10-28
      • 2015-09-05
      • 1970-01-01
      • 2013-10-05
      • 2019-10-17
      • 2012-09-09
      • 1970-01-01
      • 2018-01-05
      • 2023-03-22
      相关资源
      最近更新 更多