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

  • SEARCH
  • Home
  • 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 552791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:32:15+00:00 2026-05-13T11:32:15+00:00

I have 2 tables A and B that have a many to many relationship.

  • 0

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();
        }
  • 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. Editorial Team
    Editorial Team
    2026-05-13T11:32:15+00:00Added an answer on May 13, 2026 at 11:32 am

    Many to many is setup different ways depending on structure. If class A has a collection of B entities, you can bind it directly to the DataSource property as in:

    <asp:Repeater ... DataSource="<% Eval("Bs") %>">
    

    So it depends on how the entities are referenced in your object model, which again varies depending on the many to many setup. Check this out: http://thedatafarm.com/blog/data-access/inserting-many-to-many-relationships-in-ef-with-or-without-a-join-entity/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 NHibernate entities (tables) that are in a one to many relationship.
i have a many to many table relationship that involves 2 logical tables. Record
I have two database tables that have a many to many relationship: People and
I hate these three tables that. Two tables have a many to many relationship
I have two tables, that relate via a one-to-many relationship i.e tableOne (1)----------(*) tableTwo
I have two tables (groups and parties) in a many to many relationship using
In Access 2010, I have tables Task and Action that have a many-to-many relationship
I have a one to many relationship with a child form that is nested
I have a data table that contains a one-to-many self referential relationship: Plant {
Background In a PostgreSQL 9.0 database, there are various tables that have many-to-many relationships.

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.