Last active
November 12, 2017 21:36
-
-
Save BenGGolden/bc0c074ea6cdf3b78aaec72befdf1216 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@* Using with a basic TagBuilder *@ | |
@{ | |
var colDiv = new TagBuilder("div"); | |
colDiv.AddCssClass("col-sm-4"); | |
colDiv.GenerateId("featureCol"); | |
} | |
<div> | |
@Html.Sitecore().DynamicPlaceholder("feature", colDiv, 3, 3) | |
</div> | |
@* 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) | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment