<FooterTemplate>
<asp:Label ID="lblEmpty" Text="No Result" runat="server" Visible='<%#bool.Parse((list.Items.Count==0).ToString())%>'>
</asp:Label>
</FooterTemplate>
list为控件名称
就这样可以了,不用做其它处理,简单好用
本文介绍如何在 ASP.NET 中使用控件判断列表是否为空,并相应显示“无结果”提示。通过设置可见性表达式,仅当列表为空时显示标签。
<FooterTemplate>
<asp:Label ID="lblEmpty" Text="No Result" runat="server" Visible='<%#bool.Parse((list.Items.Count==0).ToString())%>'>
</asp:Label>
</FooterTemplate>
list为控件名称
就这样可以了,不用做其它处理,简单好用
696

被折叠的 条评论
为什么被折叠?