本文介绍了在源代码中检查数据列表是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
<%if(datalist1!= null)
{%>
一些html
here is my code:
<%if (datalist1 != null)
{ %>
some html
<%}
else
{ %>
一些html<%}%>
但是在此代码中,如果datalist为空,则不会显示else部分.
请帮帮我.
在此先感谢
some html<%} %>
but in this code the else part are not display if datalist is empty.
Please help me.
thanks in advance
推荐答案
if (DataList1.Items.Count > 0)
{
//put your code here.
}
else
{
//put your code here.
}
<%}
else
{ %>
some html<%} %>
这篇关于在源代码中检查数据列表是否为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!