需要显示的消息时,DataList控件为空 [英] Need to Show a message when DataList is Empty

查看:116
本文介绍了需要显示的消息时,DataList控件为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用DataList控件显示在我的网页客户端站点记录,我需要显示的消息时,我的DataList控件是空的....有Datalist中的属性...如何显示该消息?

i'm using DataList to show records on Client Site of My web page i need to show a message when my DataList is empty .... is there a property of Datalist... How to show that message ?

推荐答案

SkaffmanEmptyDataText属性不被支持的DataList还。但是你可以使用下面的技巧实现几乎相同的功能。

Skaffman "EmptyDataText" property is not supported by DataList yet. But you can achieve almost same functionality using the following trick

<FooterTemplate>
<asp:Label Visible='<%#bool.Parse((DataList1.Items.Count==0).ToString())%>' runat="server" ID="lblNoRecord" Text="No Record Found!"></asp:Label>
</FooterTemplate>

这是创建在DataList控件的页脚标签,并使其可见只有DataList的记录数为0。

That is creating a Label in Footer of DataList, and make it visible only of DataList Record Count is 0.

这篇关于需要显示的消息时,DataList控件为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆