Repeater在无数据记录时显示类似GridView的无信息内容
2009-11-12 18:23
706 查看
方法就是在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><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 datalist在无数据记录时显示类似GridView空模板(EmptyDataTemplate)
- Repeater在无数据记录时显示类似GridView空模板(EmptyDataTemplate)
- Repeater在无数据记录时显示类似GridView空模板(EmptyDataTemplate)
- DataList在无数据记录时显示类似GridView空模板(EmptyDataTemplate)
- asp.net Gridview、Repeater 查无数据时显示表头及提示信息
- 清空ds中的数据记录,GridView不显示数据,隐藏
- Scott Mitchell 的ASP.NET 2.0数据教程之十五:在GridView的页脚中显示统计信息
- asp.net GridView列数据鼠标移入显示提示信息
- 用户反馈信息textbox填充数据表,页面使用gridview显示反馈意见
- GridView、Repeater等数据控件列数字、货币和日期的显示格式
- 对gridview绑定数据的操作方法及自定义显示内容
- PowerShell 2.0 CTP Out-GridView: 在数据网格中显示信息
- C#中“类似GridView等控件”的前台显示与后台数据变化之间的关系
- GridView无数据显示信息
- ListView中的数据一直显示在最底部(类似聊天中的信息列表)
- GridView、Repeater等数据控件列数字、货币和日期的显示格式
- repeater没有数据显示暂无数据,无记录
- asp.net中Repeater中嵌套Repeater来显示跟外层Repeater数据相关的其他信息
- android学习记录(十八)---AppWidget显示内容随数据改变而更新
- 在ASP.NET 2.0中操作数据:在GridView的页脚中显示统计信息