Asp.net MVC - Can I load a view from a different view folder?

前端 未结 2 2094
再見小時候
再見小時候 2020-12-16 11:13

In my app I have a need to load the same view from two different controllers without placing the view in the shared views directory.

Basically I have this folder str

2条回答
  •  春和景丽
    2020-12-16 12:01

    1. It's possible.
    2. I am not sure if you are using strong-typed views. But suppose it is, then it is a bit weird for me that you have Event search & Search with same View Model. Possibly separate them with two different view models and view would be better IMHO. Moreover, if you specify the name of view to load in controller, it is somehow considered to be coupling view and controller and it certainly not a good idea.

提交回复
热议问题