Default text for empty Repeater control

Joaos answer can even be simplified. In the footer, do not set the visible-property of your default item to false, but use the following expression:

<FooterTemplate>
    <asp:Label ID="defaultItem" runat="server" 
        Visible="<%# YourRepeater.Items.Count == 0 %>" Text="No items found" />
</FooterTemplate>

This way, you can save the code behind.

Leave a Comment