November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Other content areas do not have any tags attached right? What exactly is "only first block is shown"? Do you mean that when block is dropped on other content areas that do not have any tags attached, "StandardPageBlock" template model (or ~/Views/Blocks/StandardPage/Index.cshtml) template is used? Or only 1st block in content area is rendered and rest of the dropped blocks are not visible?
What I mean is, no matter what tag is used, the only view shown is Index.cshtml. So if I drop a StandardPage on MainContentArea(with tag), Index.cshtml is shown. And when I drop the same page in the BottomContentArea(with another tag), the same view is rendered, not the view tagged view.
EDIT:
I got this to work on my teaserblock earlier, but now it's the same problem. Same block rendering in different contentareas with different tags. With that said, no of my renderingstags are working.
What changes if you set "AvailableWithoutTags=false" to both models? Algorithm for choosing templates for content types is something not so easy to grasp.. :)
Then I get "The "StandardPage" can not be displayed".. I've read your blog on geta.no about what I'm trying to achieve, but I can't get it to work..
This is my complete TemplateRegistrator class:
[ServiceConfiguration(typeof(IViewTemplateModelRegistrator))] public class ViewTemplateRegistrator : IViewTemplateModelRegistrator { #region Implementation of IViewTemplateModelRegistrator public void Register(TemplateModelCollection viewTemplateModelRegistrator) { #region Pagepartials viewTemplateModelRegistrator.Add(typeof(StandardPage), new TemplateModel() { Name = "StandardPageBlock", Description = "Displays pages that are of type StandardPage as a block in content areas", Path = "~/Views/Blocks/StandardPage/Index.cshtml", Tags = new []{ ContentAreaTags.Main }, AvailableWithoutTag = false }); viewTemplateModelRegistrator.Add(typeof(StandardPage), new TemplateModel() { Name = "StandardPageFooterBlock", Description = "", Tags = new[] { ContentAreaTags.Bottom }, AvailableWithoutTag = false, Path = "~/Views/Blocks/StandardPage/StandardPageFooterBlock.cshtml", }); #endregion } #endregion
And this is the HTML:
<div class="container"> <div class="row"> <div class="col-md-12"> @Html.PropertyFor(m => m.CurrentPage.BlockAreaMain, new { Tag = ContentAreaTags.Main }) </div> </div> </div> <div class="container-fluid"> @Html.PropertyFor(m => m.CurrentPage.BlockAreaBottom, new { Tag = ContentAreaTags.Bottom }) </div>
Am I missing something of importance..?
EDIT:
Created my own Tag class, it looks like this:
public static class ContentAreaTags { public const string Main = "Main"; public const string Footer = "Footer"; public const string Right = "Right"; public const string Bottom = "Bottom"; }
I have been looking into my problem and also re-created a simple project with the exact same pagetypes etc. In the new project it works, in the real project, it still doesn't. Even though it all looks the same..
When using my tags on the _Layout.cshtml view it works fine. Any ideas why I can't implement it on my "regular" pages? StartPage and so on.
If you can, install please EPiServer Developer Tools and dump here all templates registered for content types.
It seems, that when I'm adding the "AvailableWithoutTag = false", it doesn't match my Contentarea-tag with my View-tag. Added it on another block and I instantly get "The "...Block" can not be displayed".. Although it works on my _Layout.cshtml.. Only difference between the layout and other pages is that I use a SettingsPage + LayoutModelFactory to bind it.
EDIT:
Again, I did a complete new project and installed my companies "template" which includes som basic features such as StartPage etc. This time, instead of re-creating everything, I simply copy-pasted the code I'm having trouble with in my real project, and it works in the new project but not in the real one.
This is solved!
A co-worker in my project had commented out some code a helperclass that was part of rendering in contentarea. This made it impossible to render page partials. Thank you for taking time to answer me Valdis!
My pleasure to help :) I was really curious why it was not working on your setup. Even spin up alloy once again to repro.. :)
If needed - more insights about CA rendering pipeline you can find in my 3 series posts: http://blog.tech-fellow.net/
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):
My view where the blocks are dropped looks like this:
But when I'm dropping the block into the different contentareas, it only shows the first block (Index.cshtml). Any ideas why?