zoukankan      html  css  js  c++  java
  • Repeater在无数据记录时显示类似GridView空模板(EmptyDataTemplate)

    方法就是在FooterTemplate加个Label并根据repeater.Items.Count判断是否有记录。关键代码如下:
    <FooterTemplate>
        
    <asp:Label ID="lblEmpty" Text="无记录.." runat="server"  Visible='<%#bool.Parse((rptRecord.Items.Count==0).ToString())%>'></asp:Label> 
    </FooterTemplate> 
    示例代码:
    <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><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>
  • 相关阅读:
    SpringDataJpa实体类常用注解
    I2C子系统
    input子系统
    platform深入
    运用层是怎样找到驱动的+open中子设备识别
    misc设备
    文章标题
    uboot2015第一阶段---SPL
    git工具使用
    Andriod底层第五课------HAL硬件抽象层
  • 原文地址:https://www.cnblogs.com/greatverve/p/1587965.html
Copyright © 2011-2022 走看看