The self optimising block and Tags


Hi All

One of our clients is using the Self Optimising Block throughout their site. On the home page though they have a slideshow, this works by using tags on a ContentArea to force the rendering through a special View file specifically designed for the slideshow.

The problem we have is that when we drop a Self Optimising Block into the Slideshow ContentArea, the tag is being applied to the Self Optimising Block instead of the ContentArea inside the Self Optimising Block so it just loads the default renderer.

I was hoping I might be able to define my own custom renderer for the Self Optimising Block like so:

viewTemplateModelRegistrator.Add(typeof(OptimizingBlock), new TemplateModel
                Name = "OptimizingSlideBlock",
                Inherited = true,
                Tags = new[] { ContentAreaTags.Slideshow },
                AvailableWithoutTag = false,
                Path = BlockPath("OptimizingSlide.cshtml")

Then from within the OptimizingSlide.cshtml view just render a Html.PropertyFor() and just pass down the correct tag.

Unfortunately though the view for the Self Optimizing Block does not use Html.PropertyFor, it is the following:

<% if (model !="null)" html.rendercontentdata(model, false); %>

Is there any alternative to this, or a way that I can use this and pass in a tag? I have tried passing the isContentInContentArea as true instead but that did not help.

Thanks very much

Jul 08, 2014 18:14

Did you find a good solution for this or does anyone else have a solution?

I have a similiar problem with doing custom rendering of the actual block inside the optimizing block.

Aug 27, 2015 13:12
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.