MVC Partial View lookup does not work OOTB
Partial view lookup by the RazorViewEngine does not work with Sitefinity OOTB.
If you take the valid default paths:
and change them to:
then the partial view lookup works as expected.
Thank you for the shared solution with the community.
More information about this could be found also in that discussion.
Your contribution is appreciated.
This should work out of the box. This solution is only a work-around to resolve this problem, but you shouldn't have to write work-arounds into your project in order to achieve the expected, default behavior of a key feature of the framework.
Regular view (i.e. not a partial) lookup does not require the additional paths to be added in order to function appropriately under the non-standard MVC foldering structure used by Sitefinity. I would expect the rest of the view file lookups to work as well.
Is this something that will be resolved in a future release?
Thank you for your feedback.
Actually the MVC used is Sitefinity is implemented as a part of the WebForms. Thus you have ability to use for example multiple MVC widgets on Page. In its implementation Sitefinity looking for the Views in the standard views folders Views/Controller and Shared.
In other words it is the expected behaviour not to find the Views placed in other folder/s except in case custom registration as you already mentioned in your initial post.
Note that the Views in Sitefinity could be under (~/MVC/Views) or directly in the root (~/Views).
In addition, we have test the view in a sub-folder of Shared folder on Standard MVC 4 application (attached) and the view is also not found without custom path registration discussed above.
Alternatively you can use Sitefinity Feather. Samples of custom MVC widgets with Feather could be found here and here.
I hope the information above was useful.
Your feedback and the shared solution provided are appreciated.
The documentation for Sitefinity states:
"All MVC artifacts in Sitefinity should be stored under the Mvc folder. Everything under that folder has the same naming convention as in a new MVC project. Controllers, Views and Models are each in their respective subfolders."
So is the documentation wrong? Or is this an implementation oversight? The partial views work if you register the path for the folder structure suggested by the documentation, but the Editor Templates issue that I described in my other post (found here for posterity) can not be fixed by registering the additional paths. The only way to get them to work is to ignore the instructions found in the product documentation, and split your files into two areas of your project.
After further investigation and looking on the error log in the mentioned by you forum thread the issue seems related to the bug logged and discussed here.
Until the bug is being fixed you can use the workaround proposed there.
I hope the information helps.