When Repeater contains no items it's not get rendered in HTML at all, even HeaderTemplate or FooterTemplate. I need to manipulate it on client-side even if it's empty.
Is there any way to always render Repeater in HTML?
In the <FooterTemplate>, add a Label with some empty data text and set its visible property to false.
<FooterTemplate>
<table>
 <tr>
 <td>
 <asp:Label ID="lblEmptyData"
        Text="No Data To Display" runat="server" Visible="false">
 </asp:Label>
 </td>
 </tr>
 </table>           
 </FooterTemplate>
Now check the the data while binding repeater, if no rows return then make label visible otherwise no action.
More details here.
as @Saurabh said, use <FooterTemplate> add a Label with specifying your message in the Text property and set its visible property to false like this:
<FooterTemplate>
        <%-- Label used for showing Error Message --%>
        <asp:Label ID="ErrorMessage" runat="server" Text="Sorry!!" Visible="false">
        </asp:Label>
    </FooterTemplate>
Then in the code-behind use the following logic; if there is no data, show the message, otherwise, show the data as following:
protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
    Repeater rpt = sender as Repeater; // Get the Repeater control object.
    // If the Repeater contains no data.
    if (rpt != null && rpt.Items.Count < 1)
    {
        if (e.Item.ItemType == ListItemType.Footer)
        {
            // Show the Error Label (if no data is present).
            Label ErrorMessage = e.Item.FindControl("ErrorMessage") as Label;
            if (ErrorMessage != null)
            {
                ErrorMessage.Visible = true;
            }
        }
    }
}
<asp:Repeater ID="rptList" runat="server" DataSourceID="odsList">  
    ...
    <FooterTemplate>  
        <%if (rptList.Items.Count == 0)  
          { %>  
          **Your message**  
        <%} %>  
    </FooterTemplate>  
</asp:Repeater>
Try this
protected bool IsDataEmpty     
  {    
       get    
       {    
           ICollection list = Repeater1.DataSource as ICollection;    
           return list.Count == 0 ? true : false;    
       }    
  }
In Markup :
<table width="80%">   
     <tr runat="server"
         visible='<%# IsDataEmpty %>'>    
         <td>    
             There is no data to display    
           </td>    
     </tr>
for step by step follow the link :Link
来源:https://stackoverflow.com/questions/6579814/render-empty-repeater