方法就是在FooterTemplate加个Label并根据repeater.Items.Count判断是否有记录。关键代码如下:

<FooterTemplate>
<asp:Label ID="lblEmpty" Text="无记录.." runat="server"  Visible='<%#bool.Parse((rptRecord.Items.Count==0).ToString())%>'></asp:Label>
</FooterTemplate>

示例代码:

repeater没有数据显示暂无数据,无记录

<table class="r_line" cellpadding="3" cellspacing="1" width="100%">
<tr class="r_title">
<td>编号</td>
</tr>
<asp:Repeater ID="rptRecord" runat="server">
<ItemTemplate>
<tr style='background-color:<%#(Container.ItemIndex%2==0)?"#fff":"#eee"%>'>
<td><a href='Detail.aspx?PID=<%=Request.QueryString["PID"] %>&did=<%#Eval("PID") %>'><%#Eval("PID") %></a></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr class="r_bg">
<td>
<asp:Label ID="lblEmpty" Text="无记录.." runat="server"  Visible='<%#bool.Parse((rptRecord.Items.Count==0).ToString())%>'></asp:Label>
</td>
</tr>
</FooterTemplate>
</asp:Repeater>
</table>

repeater没有数据显示暂无数据,无记录

相关文章:

  • 2021-10-10
  • 2021-12-19
  • 2023-03-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-25
相关资源
相似解决方案