I have an ASP.NET page that uses a repeater nested in another repeater to create a list of data. This leads to the following:
<asp:Repeater> <ItemTemplate> <span><%#Eval("Data1") %></span> <asp:Repeater DataSource='<%#Eval("Data2")%>'> <HeaderTemplate> <ul> </HeaderTemplate> <ItemTemplate> <li><%#Container.DataItem%></li> </ItemTemplate> <FooterTemplate> </ul> </FooterTemplate> </asp:Repeater> </ItemTemplate> </asp:Repeater>
In code (C #), I mainly use LINQ to pull a list of information from an XML document and associate this information with the first relay.
Looking for an answer to this question, it seems that the method should determine if the data is empty for the nested repeater. If so, you set the visibility of the repeater to false.
Unfortunately, I was not able to determine how to do this, and not in the code (since it will not necessarily work for what I am doing).
Since my pages are not being checked now, because ul ends up empty for any elements without Data2, and because I want to continue using the unordered list, I am turning to you for help.
Any ideas?
Thanks!
UPDATE:
If this helps, since it is entirely possible to do in the code, LINQ is something with this:
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();
James skemp
source share