I have this method inside my controller that calls this partial view:
return PartialView("_tinzProdListPageTemplate", tblStoreLocation);
That partial view is inside the Shared
folder and the above code works fine and loads the view. But now I want to move _tinzProdListPageTemplate
to another folder that is inside the Shared
folder called Templates
so that I can better organize my project.
I tried these but they don't work. It seems that only when calling straight from the default Shared
folder, can you load a partial view from the controller. (I even tried adding .cshtml
to the end as the extension on the examples above but did not work either)
return PartialView("Templates/_tinzProdListPageTemplate", tblStoreLocation);
return PartialView("Shared/Templates/_tinzProdListPageTemplate", tblStoreLocation);
return PartialView("~/Shared/Templates/_tinzProdListPageTemplate", tblStoreLocation);
So how do I return a PartialView
that is not inside the Shared
folder. Its inside a folder that is inside the Shared
folder?
I am using ASP.NET MVC 5 running on the .NET Framework.
This is the error I get:
The partial view '_tinzProdListPageTemplate' was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Store/_tinzProdListPageTemplate.aspx
~/Views/Store/_tinzProdListPageTemplate.ascx
~/Views/Shared/_tinzProdListPageTemplate.aspx
~/Views/Shared/_tinzProdListPageTemplate.ascx
~/Views/Store/_tinzProdListPageTemplate.cshtml
~/Views/Store/_tinzProdListPageTemplate.vbhtml
~/Views/Shared/_tinzProdListPageTemplate.cshtml
~/Views/Shared/_tinzProdListPageTemplate.vbhtml