I have this list of object:
public List<XHTMLError> Report = new List<XHTMLError>();
Which is defined this way:
public class XHTMLError
{
public List<string> Errors = new List<string>();
private string _errorType;
public string ErrorType { get { return _errorType; } set { _errorType = value; } }
}
I am currently binding the collection to a repeater (used for an xml file) that contains another repeater (for the errors contained in the list of the XHTMLError object. It looks like this currently but the second repeater is not working, there must be some misunderstanding from my part of LINQ or ASP repeater.
<%@ Import Namespace="System.Linq" %>
<?xml version="1.0" encoding="utf-8" ?>
<ERRORS>
<INFO Page_Affected="<% %>" Total_Errors="<% %>" />
<asp:Repeater ID="types" runat="Server">
<ItemTemplate>
<ERROR type="<%# Eval("ErrorType") %>">
<asp:Repeater id="pagelist" runat="Server" datasource="<%# Report.Where(p => p.ErrorType == Container.DataItem.ToString()).Select(result => result.Errors) %>" >
<ItemTemplate>
<page id="<% %>" path="<% %>" />
</ItemTemplate>
</asp:Repeater>
</ERROR>
</ItemTemplate>
</asp:Repeater>
</ERRORS>
(The id is the element itself inside the collection Errors.