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 6647735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:34:22+00:00 2026-05-26T00:34:22+00:00

I have a table SiteUsers with SiteUserID, FirstName, LastName and SiteUserParentID. Every SiteUser is

  • 0

I have a table SiteUsers with SiteUserID, FirstName, LastName and SiteUserParentID.

Every SiteUser is assigned a SiteUserParentID which is referencing a SiteUserID.

I’d like to show the relationship with the full name of the SiteUser along with the full name of who they are assigned to.

What is the best way to do this?

    SiteUserID, FirstName, LastName ParentID
      1       , John     , Doe     , 1
      2       , Sallie   , Smith   , 1

I’m looking for the output to be:

ChildName   , ParentName
John Doe    , John Doe
Sallie Smith, John Doe

I of course want to dump this into an asp.net repeater and have the output be:

John Doe is assigned to John Doe
Sallie Smith is assigned to John Doe

Currently, I’m looking at:

John Doe is assigned to 1
Sallie Smith is assigned to 1

using the following:

    static public List<SiteUser> GetSiteUserListFullName()
{
    List<SiteUser> thelist = new List<SiteUser>();
    string sql = "select SiteUserID, SiteUserFirstName + ' ' + SiteUserLastName as SiteUserName, SiteUserParentID from SiteUsers where SiteUserActive = 1";
    SqlDataReader dr = DBUtil.FillDataReader(sql);

    while (dr.Read())
    {
        SiteUser obj = new SiteUser();

        obj.siteUserID = Convert.ToInt32(dr["siteUserID"].ToString());
        obj.siteUserFirstName = Convert.ToString(dr["siteUserName"].ToString());
        obj.siteUserParentID = Convert.ToInt32(dr["siteUserParentID"].ToString());
        thelist.Add(obj);
    }
    return thelist;
}

And this in my code behind:

    repeaterTeams.DataSource = SiteUser.GetSiteUserListFullName();
    repeaterTeams.DataBind();

And this on the front end:

<asp:Repeater ID="repeaterTeams" runat="server">
<HeaderTemplate>
    <table class="horTable">
    <tr class="tableHeader">
        <td class="first">Assignment</td>
        <td class="last">Edit</td>
    </tr>
</HeaderTemplate>
<ItemTemplate>
    <tr class="tableRow">
        <td><%#DataBinder.Eval(Container.DataItem, "SiteUserFirstName")%> is assigned to <%#DataBinder.Eval(Container.DataItem, "SiteUserParentID")%></td>
        <td class="last"><a href="selected-team.aspx?id=<%#DataBinder.Eval(Container.DataItem, "SiteUserID")%>">Select</a></td>
    </tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>

Any help is appreciated.

Thanks!

  • 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-26T00:34:23+00:00Added an answer on May 26, 2026 at 12:34 am

    You need to join the table on itself.

    Example:

    select 
        child.SiteUserFirstName + ' ' + child.SiteUserLastName as ChildName,
        parent.SiteUserFirstName + ' ' + parent.SiteUserLastName as ParentName 
    from 
        SiteUsers as child
    inner join 
        SiteUsers as parent on child.SiteUserParentID = parent.SiteuserID
    where 
        child.SiteUserActive = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table definition like below: Place (id, name) Review (id, userid, placeid) Favorite
I have table with 50 entries (users with such details like Name Surname Location
I have table in my database which has fields of ID,NAME,CONTEXT. I am showing
I have table in an MS Access database that looks like this: ID Symbol
I have table view which is populated from an array grabbed from a url.
I have a table like below: There are multiple WebSiteIDs. I'd like the output
I have a 'SessionVisit' table which collects data about user visits. The script for
I have table like this: Code label Zone Price ---- ----- ---- ----- 049
I have table Products where I store my products and another table Votes which
I have table with data about tasks like Id, Name, Date, WorkerId, VehicleId (and

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.