Try our conversational search powered by Generative AI!

Per Nergård
Sep 21, 2015
  1891
(1 votes)

WebControl for bootstraprows and contentareas

If there still are anyone out there using forms maybe this can be of some use.

Scenario is that you have a template with:

  • One or many rows, with different combinations of content areas and other properties.
  • All properties are rendered as columns.
  • None of the properties are required.
  • We assume that the editors either add values to all properties in a row or add no values at all.

If the editor doesn't add values to atleast one of the properties in a row we would end up with a empty bootstrap row which we don't want to.

To avoid having to write codebehind code to handle this I did a webcontrol. The webcontrol checks all inner properties (which must be of type EPiServer:Property) and if all are empty the row isn't rendered.

Example:

<Nergard:BootstrapRow CssClass="row" runat="server">
    <EPiServer:Property PropertyName="ContentArea" runat="server" CustomTagName="div" CssClass="col-md-6"/>
    <EPiServer:Property PropertyName="MainBody" runat="server" CustomTagName="div" CssClass="col-md-6"/ />
</Nergard:BootstrapRow>

You can use both the PageLink and PageLinkPropertyName attributes in the EPiServer:Property if you want to use them.

Code over at GitHub Gist:  Code.

Sep 21, 2015

Comments

Please login to comment.
Latest blogs
Optimizely Forms: Safeguarding Your Data

With the rise of cyber threats and privacy concerns, safeguarding sensitive information has become a top priority for businesses across all...

K Khan | May 16, 2024

The Experimentation Process

This blog is part of the series -   Unlocking the Power of Experimentation: A Marketer's Insight. Welcome back, to another insightful journey into...

Holly Quilter | May 16, 2024

Azure AI Language – Sentiment Analysis in Optimizely CMS

In the following article, I showcase how sentiment analysis, which is part of the Azure AI Language service, can be used to detect the sentiment of...

Anil Patel | May 15, 2024 | Syndicated blog

Optimizely Data Platform Visitor Groups now supports multiple instances

The module V2.0 now supports multiple Optimizely Data Platform instances, allowing personalized content based on real-time segments and profile dat...

Andrew Markham | May 15, 2024 | Syndicated blog