考虑一个有 2 个区域的项目。
/区域/博客 /区域/仪表板
现在假设我的博客区域有一个 SpecialBlog 类型的编辑器。/Areas/Blog/Views/Blog/EditorTemplates/SpecialBlog.ascx
如果我的仪表板区域中的视图想要显示一个特殊的博客怎么办?
以下代码适用于“博客”区域内的视图,但不适用于“仪表板”区域。
Html.EditorFor (model => model) // model is type SpecialBlog
即使提供路径失败,
Html.EditorFor (model => model, "~/Areas/Blog/Views/Blog/EditorTemplates/SpecialBlog.ascx")
我能得到工作的一件事是
Html.RenderPartial (Model, "~/Areas/Blog/Views/Blog/EditorTemplates/SpecialBlog.ascx");
但是,SpecialBlog 中的任何路由都会失败。(即,它有自己的 Html.EditorFor 调用博客区域中的其他编辑器模板)。
我在做一些根本错误的事情吗?