Error: Partial view ' FormContainerBlock' was not found.



I just installed the Episerver Forms and got this error. Wroking with forms for the first time that's why may missed some step. Please help to resolve this issue.

This is the installed location in solution.


Apr 03, 2020 9:13
Edited, Apr 03, 2020 15:27
Praful Jangid - Apr 07, 2020 8:24
So, in the link, he is doing customization. But I have just installed that in a new project. The only difference I see is we don't have a folder structure defined in Forms.config like ~/views/Shared/ElementBlocks. We have custom structure for our views under Features folder.

Hi Praful,

Looking at the view locations where from the for 'FormContainerBlock' is looked for, you are missing the FormContainerBlock.ascx

Doing a quick demo with Alloy and removing the view engine 'EPiServer.Forms.EditView.FormsWebFormViewEngine' from the site view engines collection will cause the same issue you are showing.

From the view locations in the error message we can see that you are using custom view engine so your code is at least adding a new view engine, but also check your code that you are not actually removing view engines, because you need to be careful what you remove or you have this kind of situation.

Edited, Apr 04, 2020 8:14
Praful Jangid - Apr 07, 2020 9:53
We are having different Project structure. We don't have the folder structure like ~/views/Shared. We have custom structure like ~/Feature/FeatureName/feature.cshtml. So, is it the issue? If yes, do I need to keep that default folder structure of ~/Views/Shared ?
Antti Alasvuo - Apr 07, 2020 10:09
Praful, you can have your own structure and view engines. Read the Episerver Forms documentation and title "Default location for view templates" it tells how to configure a custom location.

In the post that Ravindra linked, see the link by Marija.

But how about your current solutions view engines? Could in your local environment check what view engines you have? Debug print the view engine names from System.Web.Mvc.ViewEngines.Engines (print out the types full name), that way you know which view engines you have in your app. As I pointed out in my answer there should be the view engine 'EPiServer.Forms.EditView.FormsWebFormViewEngine' for example - if that is removed you have no view engine that would look for the usercontrol to render the container (unless you configure it to use something else) FormContainerBlock.ascx (this file is in the _protected\EPiServer.Forms\\Views\ElementBlocks\FormContainerBlock.ascx)
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.