DataList和Repeat无数据时提示暂无数据几种方法

Html代码 复制代码
  1. <FooterTemplate>  
  2.    <td style="height: 16px">  
  3.         <asp:Label ID="Label1" runat="server" Text="暂无检索记录!" Visible="false"></asp:Label>  
  4.         </td>  
  5.    </FooterTemplate>  
 <FooterTemplate>    <td style="height: 16px">         <asp:Label ID="Label1" runat="server" Text="暂无检索记录!" Visible="false"></asp:Label>         </td>    </FooterTemplate>

 

 

C#代码 复制代码
  1. protected void rpSearch_ItemDataBound(object sender, RepeaterItemEventArgs e)   
  2.    {   
  3.        if (e.Item.ItemType==ListItemType.Footer)   
  4.        {   
  5.            if (rpSearch.Items.Count<=0)   
  6.            {   
  7.                ((Label)e.Item.FindControl("Label1")).Visible = true;   
  8.            }   
  9.        }   
  10.    }  

posted on 2010-11-29 14:41  woshilee  阅读(235)  评论(0)    收藏  举报

导航