ASP.NET MVC中部分视图的正确位置是什么? [英] What is the correct place for Partial Views in ASP.NET MVC?

查看:91
本文介绍了ASP.NET MVC中部分视图的正确位置是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人会确认ASP.NET MVC中部分视图的最佳位置吗?

Would someone confirm the best place for a partial view in ASP.NET MVC?

我的想法是,如果要在很多地方使用全局视图,然后共享.

My thinkings are if it's a global view that's going to be used in many places then SHARED.

如果它是视图的一部分,被包装为部分视图以使代码阅读更加容易,则应将其放入Views/Controller目录

If it's part of a view that's been wrapped up into a partial view to make code reading easier, then it should go into the Views/Controller directory

我要纠正还是缺少什​​么?

Am I correct or am I missing something?

推荐答案

我相信您是正确的.这是我执行的一个示例,即共享"目录中的常规导航局部视图.然后是Views/[ControllerName]目录中特定控制器的局部视图.

I believe you are correct. Here is an example of something I do, general navigation partial views in my Shared directory. and then a partial views for a specific Controller in the Views/[ControllerName] Directory.

这篇关于ASP.NET MVC中部分视图的正确位置是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆