Take the community feedback survey now.
AI OnAI Off
Take the community feedback survey now.
Hi,
Maybe you could register your own ContentArea renderer
private static void ConfigureContainer(ConfigurationExpression container)
{
container.For<ContentAreaRenderer>().Use<AlloyContentAreaRenderer>();
}
public class AlloyContentAreaRenderer : ContentAreaRenderer
{
protected override void RenderContentAreaItems(HtmlHelper htmlHelper, IEnumerable<ContentAreaItem> contentAreaItems)
{
var maxElements = htmlHelper.ViewContext.ViewData["maxElements"];
if (maxElements != null)
{
contentAreaItems = contentAreaItems.Take((int)maxElements);
}
base.RenderContentAreaItems(htmlHelper, contentAreaItems);
}
}
I didnt test this code.
Hi,
is there a way to limit the number (e.g. max 10) of content area items to render without using a valdiation.
Thanks