I'm new to ASP.NET, and I'm trying to figure out how to only show a chunk of code in the .aspx file if a value is not null or whitespace. Here's what I have, within a DetailsView
:
<asp:TemplateField HeaderText="Phone">
<EditItemTemplate>
<asp:TextBox runat="server" ID="txtPhone" Text='<%# Bind("Phone") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<a href="tel:<%# Eval("Phone") %>">
<i class="icon-phone"></i>
<%# Eval("Phone") %>
</a>
</ItemTemplate>
</asp:TemplateField>
I want to conditionally hide the whole a
tag if Eval("Phone")
is null or whitespace. I would prefer to do this all in the markup, as opposed to doing something in the code-behind.