Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 86901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:19:07+00:00 2026-05-10T22:19:07+00:00

I have an ASP.NET page that uses a repeater nested within another repeater to

  • 0

I have an ASP.NET page that uses a repeater nested within another repeater to generate a listing of data. It’s to the effect of the following:

<asp:Repeater>     <ItemTemplate>         <span><%#Eval('Data1') %></span>         <!-- and many more -->         <asp:Repeater DataSource='<%#Eval('Data2')%>'>             <HeaderTemplate>                 <ul>             </HeaderTemplate>             <ItemTemplate>                 <li><%#Container.DataItem%></li>             </ItemTemplate>             <FooterTemplate>                 </ul>             </FooterTemplate>         </asp:Repeater>     </ItemTemplate> </asp:Repeater> 

In the (C#) code-behind I’m basically using LINQ to pull a listing of information from an XML document and bind that information to the first repeater.

Searching for the answer to this, it seems the method is to determine whether the data for the nested repeater is empty. If it is, then you set the visibility of the repeater to false.

Unfortunately, I haven’t been able to determine how to do that inline, and not in the code-behind (since it won’t necessarily work for what I’m doing).

Since my pages aren’t validating now, because the ul ends up being empty for any items without Data2, and because I’d like to keep using an unordered list, I seek your help.

Any ideas?

Thanks!

UPDATE:

If it helps, since it could very well be possible to do in the code-behind, the LINQ is something to this effect:

var x = from y in z     select new {         Data1 = d,         // etcetera         Data2 = (from j in k             where j.Value != String.Empty             select j.Value).ToList()     };  blah.DataSource = x; blah.DataBind(); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:19:08+00:00Added an answer on May 10, 2026 at 10:19 pm

    This won’t hide the repeater completely, but you can subclass the Repeater control so that it includes a GridView-like empty data template:

    using System; using System.Web.UI; using System.Web.UI.WebControls;  public class EmptyCapableRepeater : Repeater {     public ITemplate EmptyDataTemplate { get; set; }      protected override void OnDataBinding ( EventArgs e )     {         base.OnDataBinding( e );          if ( this.Items.Count == 0 )         {             EmptyDataTemplate.InstantiateIn( this );         }     } } 

    You can them use it in your .aspx like this:

    <custom:EmptyCapableRepeater runat='server' ID='rptSearchResults'>     <ItemTemplate>         <%# Eval( 'Result' )%>     </ItemTemplate>     <SeparatorTemplate>         <br />     </SeparatorTemplate>     <EmptyDataTemplate>         <em>No results were found.</em>     </EmptyDataTemplate> </custom:EmptyCapableRepeater> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET page A that uses a data layer assembly DAL .
At my place of work, we have an ASP.NET page that uses the following
I have an ASP.NET page that uses the ASP.NET Ajax Control Toolkit TabContainer .
We have an ASP.Net page that uses a checkbox to toggle between a list
I have a web site in asp.net that uses a master page. In this
I have an ASP.Net page that contains a <div> with an <img> tag within.
Let say i have one asp.net application that is having some page that uses
I have an ASP.NET application that uses a master page configuration. What I'd like
I have a simple ASP.NET page that uses the VLC media player to play
I have a login page that uses ASP.NET membership. Once I've validated the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.