Episerver Forms - Custom FormContainerBlock - ViewBag is Empty

  • Updated

When customers want to use Custom FormContainerBlock view to render their custom forms, they may run into errors in View because ViewBag comes as Empty.

Try including this segment of code within the Index() method:

public override ActionResult Index(FormContainerBlock currentBlock)
 {
            var viewResult = base.Index(currentBlock) as PartialViewResult;

            viewResult.ViewName = "CustomFormContainerBlockModel";

            return viewResult;
}