asp.net – 呈现空转发器

前端之家收集整理的这篇文章主要介绍了asp.net – 呈现空转发器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当Repeater不包含任何项目时,它根本不会以 HTML格式呈现,甚至是HeaderTemplate或FooterTemplate.我需要在客户端操纵它,即使它是空的.

有没有办法总是在HTML中呈现Repeater?

解决方法

在< FooterTemplate>中,添加带有一些空数据文本的Label,并将其visible属性设置为false.
  1. <FooterTemplate>
  2. <table>
  3. <tr>
  4. <td>
  5. <asp:Label ID="lblEmptyData"
  6. Text="No Data To Display" runat="server" Visible="false">
  7. </asp:Label>
  8. </td>
  9. </tr>
  10. </table>
  11. </FooterTemplate>

现在检查绑定转发器时的数据,如果没有返回行,则make label可见,否则无法执行操作.

更多细节here.

猜你在找的asp.Net相关文章