数据列表中使用空数据文本 [英] empty data text use in datalist

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

问题描述

emptydatatext在datalist中使用如gridview?

解决方案

这不是问题,但因为我想我知道你在问什么,只因为我最近这样做了,我会给你代码。



DataList没有EmptyDataText属性,但你可以使用FooterTemplate来实现。例如:



 <   footertemplate  >  
< asp:label visible = <%#bool.Parse((dl1.Items.Count == 0 )。ToString())%> xmlns :asp = #unknown > ;
runat =serverID =lblNoRecordText =None> < / asp:label >
< / footertemplate >





如果有任何记录,这将使页脚模板可见。


在页脚模板中:



< asp:label id =   Mensaje runat =   server visible =  <%#If(DataList1.Items.Count = 0,True,False)%> ;; text =   PRODUCTO NO ENCONTRADO> 
< / asp:label >


emptydatatext use in datalist like gridview?

解决方案

This is not a question but since I think I know what you are asking, only because I did this recently, I'll give you the code.

DataList does not have an EmptyDataText property but you can do it using a FooterTemplate. For example:

<footertemplate>
   <asp:label visible="<%#bool.Parse((dl1.Items.Count==0).ToString())%>" xmlns:asp="#unknown">
      runat="server" ID="lblNoRecord" Text="None"></asp:label>
</footertemplate>



This will make the footer template visible or not if there are any records.


In Footer Template:

 <asp:label id="Mensaje" runat="server" visible="<%# If(DataList1.Items.Count = 0, True, False)%>;" text="PRODUCTO NO ENCONTRADO">
</asp:label>


这篇关于数据列表中使用空数据文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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