Skip to content

Instantly share code, notes, and snippets.

View hermanussen's full-sized avatar

Robin Hermanussen hermanussen

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sitecore.Shell.Applications.ContentEditor.Gutters;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Data.Fields;
using Sitecore.Rules;
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Imports System.Net
Imports System.Text
Imports System.IO
<asp:PlaceHolder runat="server" Visible="<%# SomeProperty != null %>">
<p>Normal placeholder - <%# SomeProperty.Name %></p>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" Visible="<%# SomeProperty != null %>">
<p>Normal placeholder - <%# SomeProperty != null ? SomeProperty.Name : null %></p>
</asp:PlaceHolder>
<asp:Repeater runat="server" DataSource="<%# SomeProperty != null ? new int[] { 0 } : null %>">
<ItemTemplate>
<p>Simple workaround using repeater - <%# SomeProperty.Name %></p>
</ItemTemplate>
</asp:Repeater>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
namespace Website.Controls
{
public class DataPlaceHolder : PlaceHolder
{
<cl:DataPlaceHolder runat="server" Visible="<%# SomeProperty != null %>">
<p>Custom control that disables databinding children if invisible - <%# SomeProperty.Name %></p>
</cl:DataPlaceHolder>
<sc:FieldRenderer runat="server" Item="<%# SomeItem %>" FieldName="Some field" />
<sc:FieldRenderer runat="server" Item="<%# SomeItemWrapper.Item %>" FieldName="<%# SomeType.FIELD_SOME_FIELD %>" />