[英]Put all the view into one view sub folder in MVC
I'm a very beginner(Learner) in MVC. 我是MVC的初学者(学习者)。 Is this question is stupid, sorry for that.
这个问题是愚蠢的,对此感到抱歉。 I'm having three controllers
我有三个控制器
Added view for this controller and its having three sub folder views 添加了此控制器的视图及其三个子文件夹视图
Is it possible to put all view into one sub folder like this 是否可以将所有视图放入这样的一个子文件夹中
Is this stupid? 这是愚蠢的吗? Is this bad approach?
这是不好的方法吗?
ASP.NET MVC already have such all in one folder - Views/Shared
ASP.NET MVC已经在一个文件夹中包含所有这些内容-
Views/Shared
If you put your view there and call Controller
, that don't have View
in it's own folder you get the View
from Shared
. 如果您将视图放在此处并调用
Controller
,而该Controller
在其自己的文件夹中没有View
,则会从Shared
获取View
。
Also, you can try to change View location by creating Custom View Engine but it's not so easy. 另外,您可以尝试通过创建“自定义视图引擎”来更改“视图”位置,但这并不容易。 You can find how to do it here .
您可以在这里找到操作方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.