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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:51:57+00:00 2026-05-12T19:51:57+00:00

I have a table that has two columns: CommunityID PersonID And A People table

  • 0

I have a table that has two columns:

CommunityID
PersonID

And A “People” table that has (among other things):

FirstName
LastName

I would like to display a different DataGrid for each community, each datagrid having only the people that are part of that community. I would like to do this without using 4 seperate SqlDataSources.

A Repeater looks like a good way, with a DataGrid inside the ItemTemplate, but I can’t seem to make heads or tails of getting that to work with the different values for each repetition.

If anyone has any suggestions on better ways to do this, I’d be very appreciative, as this is one of my first forays into the world for ASP.NET

Thanks,

Mike

  • 1 1 Answer
  • 2 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-12T19:51:57+00:00Added an answer on May 12, 2026 at 7:51 pm

    Personally I wouldn’t use a DataGrid control, since it restricts your control over your output and they’ve been replaced by the newer GridView & ListView controls (although DataGrid is not obsolete so feel free to use it if you want). You may want to consider using the alternatives but you aren’t required to do so.

    To do what you’re looking for, you would have markup like the following:

    <asp:Repeater runat="server" ID="myRepeater" 
                  onitemdatabound="Repeater_ItemDataBound">
    <ItemTemplate>
        <asp:DataGrid runat="server" ID="myDataGrid">
        </asp:DataGrid>
    </ItemTemplate>
    </asp:Repeater>
    

    Then you’ll wire up the markup with the following code-behind:

    protected void Page_Load(object sender, EventArgs e)
    {
        myRepeater.DataSource = new Object[0];
        myRepeater.DataBind();
    }
    
    protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataGrid dg = (DataGrid)e.Item.FindControl("myDataGrid");
        object o = e.Item.DataItem;// Cast the DataItem as whatever 
                                   // your Repeater's DataSource is
    
        // ...
        // Do whatever you need to get the 
        // data source for your DataGrid here
        // ...
    
        dg.DataSource = DataGridSourceObjectHere;
        dg.DataBind();
    }
    

    The key is the Repeater’s ItemDataBound event, which is the method called every time a repeater row is created. This is where you can data bind your DataGrid source. You can put any logic you need to within this method using the RepeaterItemEventArgs parameter to access the data item you bound to your Repeater.

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

Sidebar

Related Questions

If I have a table that (among other columns) has two DATETIME columns, how
I have a table that has two datetime columns (one for start time and
I have a city table that has two columns from_city to_city now lets assume
I have created a table in Visual Studio. That table has two columns. First
I have a table, tblNoComp, that has two columns, both foreign keys pointing to
I have a table that currently has two columns per row and I need
I have a table that has two columns, ID and Value. For this example
I have a database table called users This table has two columns (that are
I have a table that has two columns both of them are continuous data.
I have table that has two columns and I need to concatenate these two

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.