Partial view was not found or no view engine supports the searched locations
Hi,
Tried to follow the "Surface Controllers" tutorial on umbraco.tv - I cant figure out why it is not working...
VS 2013 - new ASP.NET MVC 4 Web Application (Visual Basic though), removed the unnessesary files, NuGet Umbraco 7.1.8 - installed the txt starterkit.
Created a model:
Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Web Namespace Models Public Class ContactFormViewModel Private _message As String Private _name As String Private _email As String Public Property Name As String Get Return _name End Get Set(ByVal value As String) _name = value End Set End Property Public Property Email As String Get Return _email End Get Set(ByVal value As String) _email = value End Set End Property Public Property Message As String Get Return _message End Get Set(ByVal value As String) _message = value End Set End Property End Class End Namespace
Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Web Imports System.Web.Mvc Imports umbraco.Web.Mvc Imports Umbraco_7_1_8.Models Namespace Controllers Public Class ContactFormSurfaceController Inherits SurfaceController ' ' GET: /ContactFormSurface Function Index() As ActionResult Return PartialView("ContactForm", New ContactFormViewModel()) End Function End Class End Namespace
Use the partialView in "umbLayout.cshtml" (txt starterkit)
I get this System.web.HttpException: Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper
Inner exception:
The partial view 'ContactForm' was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/ContactFormSurface/ContactForm.aspx ~/Views/ContactFormSurface/ContactForm.ascx ~/Views/Shared/ContactForm.aspx ~/Views/Shared/ContactForm.ascx ~/Views/ContactFormSurface/ContactForm.cshtml ~/Views/ContactFormSurface/ContactForm.vbhtml ~/Views/Shared/ContactForm.cshtml ~/Views/Shared/ContactForm.vbhtml ~/Views/Partials/ContactForm.cshtml ~/Views/MacroPartials/ContactForm.cshtml ~/Views/ContactForm.cshtml
So in ~/Views/Shared/ both ContactForm.cshtml and ContactForm.vbhtml are searched for, but in ~/Views/Partials/ only ContactForm.cshtml is searched ?????
I've spend some time lately going through the umbraco.tv guides, so perhaps I can help from my experiance.
As per the umbraco.tv guides, the Partial view is in "~/Views/Partials/ContactForm.cshtml", is your partial view named/located contrary to this?
You can always pass the compelte path to your partial in (including the extension) if youhave refactored or relocated it.
I do however agree that it is weird it searches for VB.NET and C#.NET equivilents everywhere except in the Partials directory, perhaps this is an oversight, or perhaps its becasue of the way Umbraco's back end template editor works?
Are you dead set with VB.NET (.vbhtml) as I've only ever seen guides using C# (.cshtml)??
I think your point that the innspected paths is a bit wrong as it doesn't even try to find vbhtml's in there, but hey at least there's a workaround.
I use the same full path technique to serve partial views to embedded macro's in the RTE, these don't need to process the data (and they are out of context) so I didn't want them cluttering my Partials folders. Glad you're back in business :D
Partial view was not found or no view engine supports the searched locations
Hi,
Tried to follow the "Surface Controllers" tutorial on umbraco.tv - I cant figure out why it is not working...
VS 2013 - new ASP.NET MVC 4 Web Application (Visual Basic though), removed the unnessesary files, NuGet Umbraco 7.1.8 - installed the txt starterkit.
Created a model:
Created the view (in /Views/Partials)
The Controller
Use the partialView in "umbLayout.cshtml" (txt starterkit)
I get this System.web.HttpException: Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper
Inner exception:
The partial view 'ContactForm' was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/ContactFormSurface/ContactForm.aspx
~/Views/ContactFormSurface/ContactForm.ascx
~/Views/Shared/ContactForm.aspx
~/Views/Shared/ContactForm.ascx
~/Views/ContactFormSurface/ContactForm.cshtml
~/Views/ContactFormSurface/ContactForm.vbhtml
~/Views/Shared/ContactForm.cshtml
~/Views/Shared/ContactForm.vbhtml
~/Views/Partials/ContactForm.cshtml
~/Views/MacroPartials/ContactForm.cshtml
~/Views/ContactForm.cshtml
So in ~/Views/Shared/ both ContactForm.cshtml and ContactForm.vbhtml are searched for, but in ~/Views/Partials/ only ContactForm.cshtml is searched ?????
I dont get it.. please advise.
Hi Bjarke,
I've spend some time lately going through the umbraco.tv guides, so perhaps I can help from my experiance.
As per the umbraco.tv guides, the Partial view is in "~/Views/Partials/ContactForm.cshtml", is your partial view named/located contrary to this?
You can always pass the compelte path to your partial in (including the extension) if youhave refactored or relocated it.
I do however agree that it is weird it searches for VB.NET and C#.NET equivilents everywhere except in the Partials directory, perhaps this is an oversight, or perhaps its becasue of the way Umbraco's back end template editor works?
Are you dead set with VB.NET (.vbhtml) as I've only ever seen guides using C# (.cshtml)??
Kind Regards,
Danny "Blatant"
Additionally,
It seems it's an 'Umbraco thing'...
Here's a thread with others trying to switch to VB.NET Razor views, with no success :
http://our.umbraco.org/forum/umbraco-7/using-umbraco-7/48653-How-to-create-vb-razor%28vbhtml%29-view-in-umbraco-701
Changing
to
did the trick :) Thanks.
Cool, so forcing it does the trick thats good.
I think your point that the innspected paths is a bit wrong as it doesn't even try to find vbhtml's in there, but hey at least there's a workaround.
I use the same full path technique to serve partial views to embedded macro's in the RTE, these don't need to process the data (and they are out of context) so I didn't want them cluttering my Partials folders. Glad you're back in business :D
Kind Regards,
Danny "Blatant"
is working on a reply...