Building Hierarchical Asp:Repeater using includes

I'm trying to show a simple repeater that only shows documents nested in their category header for a specific association:\[code\]<h3>Document Category</h3><ul> <li>Document Name</li></ul>\[/code\]I have a nested repeater set up below:\[code\]<asp:repeater runat="server" ID="rptDocumentGroups"> <ItemTemplate> <h3><%# ((DocumentCategory)Container.DataItem).Name%></h3> <asp:Repeater runat="server" ID="rptDocuments"> <HeaderTemplate> <ul> </HeaderTemplate> <ItemTemplate> <li><%# ((Document)Container.DataItem).FileName%></li> </ItemTemplate> <FooterTemplate> </ul> </FooterTemplate> </asp:Repeater> </ItemTemplate></asp:repeater>\[/code\]My query pulls it correctly using this:\[code\]public List<Model.DocumentCategory> GetCategoriesWithDocuments() { using (var context = new CipollaInsuranceEntities()) { return (from docCat in context.DocumentCategory.Include("Document") orderby docCat.Name where docCat.Document.Count > 0 select docCat).ToList(); } } \[/code\]However, I need to only show documents that are applicable to the association. Should I start the linq query at the association level and include documents and document categories rather than start at the document category level? I can't add a \[code\]WHERE\[/code\] clause in this statment for the \[code\]associationID\[/code\] here because that is only included on the Document table.
 
Back
Top