I know you can put <% if %> statements in the ItemTemplate to hide controls but the column is still there. You cannot put <% %> statements into the LayoutTemplate whic
The ListView gives you full control about how the data is rendered to the client. You specify the Layout Template, and give a placeholder which will be where each item is injected.
The output of the below will give you a table, and each item will be a new TR.
Notice the use of runat='server' and visible ='<%# %>'
<asp:ListView ID="ListView1" runat="server" DataSourceID="MyDataSource" ItemPlaceholderID="itemPlaceHolder">
<LayoutTemplate>
<table>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td runat="server" id="myCol" visible='<%# (bool)Eval("IsSuperCool") %>'>
<%# Eval("SuperCoolIcon") %>
</td>
<td>
<%# Eval("Name") %>
</td>
<td>
<%# Eval("Age") %>
</td>
</tr>
</ItemTemplate>
</asp:ListView>