Try our conversational search powered by Generative AI!

Blocks not rendering in MVC

Vote:
 

I cannot get my blocks to render in an EPiServer 7.14 MVC site. I can add them to the ContentArea and they render as expected, but as soon as I publish the page they stop rendering. All that outputs to the page (in both edit mode and when visiting the site as usual) is an empty div with a lot of whitespace. If I add another block to the ContentArea they all render again - until I publish the page.

The block view:

@model SiteApp.Models.Blocks.EntranceBlock

@Model.EntranceTitle

I am rendering the ContentArea to the page like this:

@Html.PropertyFor(x => x.LinkBlocks)

The BlockController:

public class EntranceBlockController : BlockController
{
    public override ActionResult Index(EntranceBlock currentBlock)
    {
        return PartialView(currentBlock);
    }
}

And finally the BlockData:

[ContentType(DisplayName = "EntranceBlock", GUID = "1ff83501-da2f-45c6-bfcb-b77bbd65246a", Description = "")]
public class EntranceBlock : BlockData
{
    [CultureSpecific(false)]
    [Display(
        Name = "Title",
        Description = "Title of this entrance.",
        GroupName = SystemTabNames.Content,
        Order = 1)]
    public virtual String EntranceTitle { get; set; }
}

Appreciate any and all answers or prods in the right direction.

#111701
Oct 17, 2014 15:46
Vote:
 

I solved the problem. Turns out this had nothing to do with blocks, I had just forgotten to send the model to the parent view.

#111705
Oct 17, 2014 16:18
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.