EPiServer Forms: Moving your EPiSever Forms views to another location

By default, EPiServer Form views goes in the directory /Views/Shared/ElementBlocks/, however if you’d like them placed elsewhere, this is easily done by adding a simple service configuration and extending EPiServer’s CustomViewLocationBase making an addition to it’s Paths array; see below.

MyCustomViewLocationBase.cs

[ServiceConfiguration(typeof(ICustomViewLocation))]
public class MyCustomViewLocationBase : EPiServer.Forms.EditView.CustomViewLocationBase
{
  public override string[] Paths => new[] { "~/Views/Shared/Forms", GetDefaultViewLocation() };
}

Above code will allow you to keep views in a Forms directory in the Views/Shared folder.

Leave a Reply