开发者

Grid with Eval expressions

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?


<%# if(Container.DataItem != null){%>
<div>
     Number: <%# Eval("AccountNumber")%>
</div>
<div>
     File: <%# Eval("AccountFile")%>
</div>
<%}%>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜