I have 2 tables A and B that have a many to many relationship. I am using nested repeaters to show the data in a web page. My issue is, how do I write an ObjectQuery or an IQueryable query that returns the parent rows in A and the child rows in B so that I can use them as my data sources for my inner and out repeater. I have the code I wrote so far below but I am not sure if it is correct or even close.
<asp:Repeater ID="A" runat="server"><br/>
<ItemTemplate><br/>
<h2 class="Information"><br/>
<%# Eval("Name") %> (<%#Eval("Abbreviation")%>)<br/>
</h2><br/>
<hr/><br/>
<p> <%# Eval("Description")%> </p><br/>
<asp:Repeater ID="B" runat="server"><br/>
<ItemTemplate><br/>
<li><br/>
<a href="..Pages/Category.aspx?<%# Eval("ID") %>"><br/>
<%# Eval("Name") %><br/>
</a><br/>
</li> <br/>
</ItemTemplate><br/>
</asp:Repeater><br/>
</ItemTemplate><br/>
</asp:Repeater>
This is my C# codebehind so far:
using (DBEntities connection = new DBEntities())
{
ObjectQuery<A> As = connection.A;
IQueryable<A> aQuery = from a in As
orderby a.SortOrder
select a;
TechnologyRepeater.DataSource = As;
DataBind();
}