Display as: Automatic not automatically selecting template

Vote:
 

Hello

I have a problem that is driving me nuts, and I'm hoping someone can help me;

I have a block that is set to be displayed only in full width using the approach from Alloy 7.5

public class TemplateCoordinator : IViewTemplateModelRegistrator
{
	public void Register(TemplateModelCollection viewTemplateModelRegistrator)
	{
		viewTemplateModelRegistrator.Add(typeof(BlockArea), new TemplateModel
		{
			Tags = new[] { Constants.ContentAreaTags.FullWidth },
			AvailableWithoutTag = false,
			Path = "~/views/shared/blocks/blockareafullwidth.cshtml"
		});

    

When I add the block to a content area (and Display As gets set to Automatic) it is not displayed, instead I get the error "... can not be displayed".

When I set Display as to full width it is displayed correctly.

When I run the Alloy package the Jumbotron block is displayed with the full template even if Display as is set to Automatic.

I have tried all sorts of things but I simple can not get this working.

What have I missed? What is required in order for this to work.

Thanks
Fredrik

#82902
Mar 21, 2014 9:59
Vote:
 

You should add a default tag to your content area rendering. 

@Html.PropertyFor(x => x.CurrentPage.MainContentArea, new {tag = Global.ContentAreaTags.FullWidth })

    

This way, it will use the "FullWidth" tag when "automatic" is chosen.

#82905
Edited, Mar 21, 2014 10:22
Vote:
 

Thanks a bunch! I knew there had to be one piece missing in the puzzle.

#82922
Mar 21, 2014 12:59
* 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.