如何检查数据表是否为空 [英] How to check datalist empty

查看:133
本文介绍了如何检查数据表是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查数据列表是否为空.我想使用数据列表在收件箱中显示消息.如果用户收件箱为null,那么我想显示类似抱歉,您没有消息"之类的消息.

How to check datalist is empty. I want to display message in inbox using datalist. if user inbox is null then i want to display a message like "Sorry You have no message"

推荐答案

您可以使用

You can use

datalist1.Items.Count



为此.

有关更多详细信息,请参见此

http://forums.asp.net/t/1158965.aspx/1 [ ^ ]



for that purpose.

For more details see this

http://forums.asp.net/t/1158965.aspx/1[^]


这可能帮助您....
This may help you....
if(dataList1.Items.Count > 0)
{
    // your code
}
else
{
    // give message to empty datalist....
}


您可以在数据列表中使用模板(空模板).

在ASP.NET转发器控件中处理空数据 [在DataList控件中处理空数据 [ ^ ]
You can use templates(empty template) in the Datalist.

Handling Empty Data in an ASP.NET Repeater control[^]

Handling Empty Data in DataList control[^]


这篇关于如何检查数据表是否为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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