@Shawn, the easiest way to handle it is to use placeholders and check the values. Attempting to use if()else
in a transformation is better served using a custom transformation method. In my example, the if
is in the placeholder and the else
wasn't in a placeholder. So I was assuming the else
was the default or false value.
<asp:PlaceHolder ID="ph1" runat="server" Visible='<%# IfEmpty(Eval("BuildingName"), false, true) %>'>
<ul class="something">
</asp:PlaceHolder>
<li><%# Eval("YourColumn") %></li>
<asp:PlaceHolder ID="ph2" runat="server" Visible='<%# IfEmpty(Eval("BuildingName"), false, true) %>'>
</ul>
</asp:PlaceHolder>
In this example, it will always render the <li>
tags but on render the opening and closing <ul>
tags when the column BuldingName
is not empty.