如何在MVC中创建View就像嵌套控制器结构一样 [英] How to created View as like nested controller Structure in MVC

查看:52
本文介绍了如何在MVC中创建View就像嵌套控制器结构一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我是MVC的新手,我在MVC 4中创建了Project。



我在这样的mvc中创建控制器



控制器/管理员/ AdminUserController.cs文件现在我在adminusercontoller中右键单击索引方法时添加视图然后他在这样的View文件夹中添加一个视图



View / AdminUser / Index.csHTML但是我想添加这样的



查看/管理员/ AdminUser / Index.cshtml



如果我手动执行并运行项目,则找不到视图并给出错误。所以我需要手动添加完整的路径来删除错误。但我不想这样做。请解决我的问题给我一个想法。



谢谢

Ram Kumar

解决方案

< blockquote>我只是留下硬编码的路径,但如果你谷歌如何更改视图的路径发现你应该得到一些想法



http://stackoverflow.com/questions/ 632964 / can-i-a-custom-location-to-search-for-views-in-asp-net-mvc [ ^ ]

Hi,

I am new in MVC and I am creating Project in MVC 4.

I am Creating Contoller in mvc like this

"Contoller/Administrations/AdminUserController.cs" File Now I am adding view when i right click on index method in "adminusercontoller" then he add a view in View Folder like this

"View/AdminUser/Index.csHTML" but I want to add like this

"View/Administrations/AdminUser/Index.cshtml"

If i make this manually and run project it cannot find view and give error. so I need to manually add the complete path to remove error. But I do not want to do this. Please solve my problem give me idea.

Thanks
Ram Kumar

解决方案

I'd just leave the paths hardcoded but if you google for how to change the path discovery for views you should get some ideas

http://stackoverflow.com/questions/632964/can-i-specify-a-custom-location-to-search-for-views-in-asp-net-mvc[^]


这篇关于如何在MVC中创建View就像嵌套控制器结构一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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