Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
@* Using with a basic TagBuilder *@
var colDiv = new TagBuilder("div");
@Html.Sitecore().DynamicPlaceholder("feature", colDiv, 3, 3)
@* Using with a Func<DynamicPlaceholderRenderContext, TagBuilder> *@
@functions {
TagBuilder CreateColBuilder(DynamicPlaceholderRenderContext context)
var builder = new TagBuilder("div");
builder.AddCssClass("col-sm-" + 12/context.PlaceholdersCount);
builder.GenerateId("featureCol" + context.Index);
return builder;
<div class="row">
@Html.Sitecore().DynamicPlaceholder("feature", CreateColBuilder, 3, 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment