Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Page as Block rendering problem

$
0
0

Hi,

I am working on a project where I'm supposed to have three different views for my "StandardPage as block", full width, 3/4 width and 1/4 width. The width of the block is determined of which contentarea the block is dropped into. If it's dropped into the "main contentarea" it's going to be 3/4, while if dropped in the bottom contentarea it should be full width. 

I'm using a ViewTemplateRegistrator and it looks like this (only made it for bottom and main at the moment):

          viewTemplateModelRegistrator.Add(typeof(StandardPage), new TemplateModel()
            {
                Name = "StandardPageBlock",
                Description = "",
                Path = "~/Views/Blocks/StandardPage/Index.cshtml",
                Tags = new []{ Tags.ContentAreaTags.Main }
            });
                    viewTemplateModelRegistrator.Add(typeof(StandardPage), new TemplateModel()
            {
                Name = "StandardPageBlockWide",
                Description = "",
                Path = "~/Views/Blocks/StandardPage/StandardPageWide.cshtml",
                Tags = new []{ Tags.ContentAreaTags.Footer},
                AvailableWithoutTag = false
            });

My view where the blocks are dropped looks like this:

<div class="col-md-8">
                @Html.PropertyFor(m => m.CurrentPage.BlockAreaMain, new { Tag = Tags.ContentAreaTags.Main })</div>
// and<div class="container-fluid">
        @Html.PropertyFor(m => m.CurrentPage.BlockAreaBottom, new { Tag = Tags.ContentAreaTags.Footer})</div>

But when I'm dropping the block into the different contentareas, it only shows the first block (Index.cshtml). Any ideas why?


Viewing all articles
Browse latest Browse all 9076

Trending Articles