views:

30

answers:

1

I use a Telerik RadGrid control and various 'Eval' expressions to show data in my aspx pages:

<div>
     Number: <%# Eval("AccountNumber")%>
</div>
<div>
     File: <%# Eval("AccountFile")%>
</div>
...

Sometimes my DataSet is empty (ie. the AccountFile may be missing). How do I write the aspx code so as not to show the Div at all if the expression for the Eval is null or empty?

A: 
<%# if(Container.DataItem != null){%>
<div>
     Number: <%# Eval("AccountNumber")%>
</div>
<div>
     File: <%# Eval("AccountFile")%>
</div>
<%}%>
luke
Ok, it turns out that the above doesn't work for me. Any other ideas? I tried the following as well, but it didn't work:<%# (Eval("LeaseTerm") == null) ? "" : ("<div class='instanceRow'>Lease: " + Eval("LeaseTerm") + "</div>") %>
Testing123